Skip to content

Conversation

@dineshkolhe1
Copy link

Summary

Fixed an issue where clicking internal navbar anchors (About, Versions, Contribute)
caused the section titles to appear hidden behind the sticky navbar.

Changes

  • Added this into html <style> - scroll-behavior: smooth;
    scroll-padding-top: 100px;
  • Added scroll-padding or scroll-margin CSS to offset anchor jumps.
  • Verified layout on both light and dark themes.

How I tested

  1. Ran python -m http.server locally.
  2. Opened http://localhost:8000
  3. Clicked all navigation links — headings now align correctly below the navbar.

Screenshots

Before -
Screenshot 2025-11-13 230010

After -
Screenshot 2025-11-14 005207


Fixes #426

@netlify
Copy link

netlify bot commented Nov 13, 2025

Deploy Preview for stupendous-kringle-a86e81 ready!

Name Link
🔨 Latest commit c07b12e
🔍 Latest deploy log https://app.netlify.com/projects/stupendous-kringle-a86e81/deploys/69163094eb208d00085d4e0c
😎 Deploy Preview https://deploy-preview-427--stupendous-kringle-a86e81.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

/* FIX: Add scroll padding to account for fixed navbar */
html {
scroll-behavior: smooth;
scroll-padding-top: 100px; /* Adjust based on navbar height + some spacing */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please change this to 120px and remove the comments?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok , i will

<a class="navbar-brand fw-bold" href="#">
<img src="_static/images/logo-dark.png" alt="DISCOVER Cookbook" height="75" class="me-2 theme-logo dark-logo">
<img src="_static/images/logo-light.png" alt="DISCOVER Cookbook" height="75" class="me-2 theme-logo light-logo d-none">
<img src="/DISCOVER/_static/images/logo-dark.png" alt="DISCOVER Cookbook" height="75" class="me-2 theme-logo dark-logo">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please undo this change?

@AR21SM
Copy link
Member

AR21SM commented Nov 23, 2025

Can we please include this snippet at the end (under the <script> section) to fix the navbar auto-close issue?
It would be great to include this in the same PR since it’s related to the navigation behavior.
Thanks!

const navbarCollapse = document.getElementById('navbarNav');
        const navList = document.querySelector('.navbar-nav');
        
        navList.addEventListener('click', (e) => {
            if (e.target.closest('.nav-link')) {
                bootstrap.Collapse.getOrCreateInstance(navbarCollapse).hide();
            }
        });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Navbar overlap — Section headings hidden behind fixed navbar

3 participants