DISCOVER-Cookbook
DISCOVER-Cookbook copied to clipboard
Fix: prevent section headings from being hidden behind sticky navbar
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
- Added scroll-padding or scroll-margin CSS to offset anchor jumps.
- Verified layout on both light and dark themes.
How I tested
- Ran
python -m http.serverlocally. - Opened http://localhost:8000
- Clicked all navigation links β headings now align correctly below the navbar.
Screenshots
Before -
After -
Fixes #426
Deploy Preview for stupendous-kringle-a86e81 ready!
| Name | Link |
|---|---|
| Latest commit | c07b12e9598c19d77787de4a75f726ee26464b07 |
| 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...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
Can we please include this snippet at the end (under the
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();
}
});