joshuatz / joshuatz-wp-theme

Custom Wordpress Theme for Portfolio Site

Home Page:https://joshuatz.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Navbar obscuring content after anchor jump

joshuatz opened this issue · comments

This is a regression, due to the refactoring / overhaul of the navbar code. I used to have a bunch of JS to offset the scroll position after an anchor jump (e.g. a click on <a href="#mysection">Link</a>), to allow space for the navbar. I believe I removed it without replacing it during the refactor.

I think I might have seen something floating around the web on a newer way to tackle this (common) problem with a pure CSS solution (or at least less JS) - something to also look into while fixing.

There is a pure CSS solution that is newer:

html {
    /** Or, scroll-padding-top, depending on need */
    scroll-margin-top: var(--fixed-nav-height);
}