Fixes issue #7. I'm not sure how clean it feels to do it this way, but essentially we're simulating a click on the appropriate heading listed at the left hand side of the page in the menu, if the URL specifies a heading to scroll to (like this https://pages-themes.github.io/leap-day/#heading-2). This has a couple of advantages:
As far as I know there's no way to do this without JavaScript
It's decoupled from whichever scrolling framework powers the click event on the left-hand menu
But has a caveat:
This will only work for headings listed in the left-hand menu (h1 and h2) so h3-h6 will have the same issue as before (unless we add them to the menu by changing the selector here).
I've tried to stick with the existing coding style.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Fixes issue #7. I'm not sure how clean it feels to do it this way, but essentially we're simulating a click on the appropriate heading listed at the left hand side of the page in the menu, if the URL specifies a heading to scroll to (like this
https://pages-themes.github.io/leap-day/#heading-2
). This has a couple of advantages:But has a caveat:
h1
andh2
) soh3-h6
will have the same issue as before (unless we add them to the menu by changing the selector here).I've tried to stick with the existing coding style.