Archived topic
Menu anchor offset for page built with Sections
5 replies · Started by Maren on February 11, 2019
Hi, I'm trying to link each of the four sections on a page (built using Sections) to their own dropdown menu link. The parent menu item I'm linking with the page URL, the sections with the Custom ID. Everything works in tablet and mobile but in the desktop version, while clicking on the dropdown link does scroll to the indicated section, the section heading is mostly covered by the sticky menu. (Smooth scrolling is on)
Two questions:
1) Is there any way I can offset the scroll so the whole section heading is visible?
2) Should I include the page URL before the Custom ID in the menu link? I haven't gone live yet with the page but in testing, the dropdown links only seem to work when I am on the actual page the section is on, but the client would obviously want visitors to be able to click on one of links in the dropdown menu and have it work from anywhere on the site.
Thank you.
Hi there,
I visited your page but don't see any anchors.
Have you checked out this article?
https://docs.generatepress.com/article/smooth-scroll/
The smooth scroll option integrated with the sticky navigation, so the top of your anchor point isn’t hidden.
Let me know :)
Thank you, that worked beautifully (and so easy once you know it).
The page I am attempting this on is not yet published as the site is live and I'm only publishing the page if it works, that's why you couldn't find it.
Only problem now is that if I add the page URL before the #section-ID, it takes me to the top of the page, not the section (although once on the page, the anchor works as intended).
And if I only put in the #section-ID without the page URL, nothing happens when I click on the dropdown menu item on my test page unless I am already on that page.
Does this menu anchor to sections on a page only work properly on a one page website or am I missing something?
Yeah it only works when the anchor is on the same page currently.
Aah, ok. Thank you for your help all the same. I'll just have to rethink that whole part then.
No problem :)