Anchor links scrolling to incorrect position ONLY if starting at the top of page
-
My team has decided that this site navigation will be dependent on using anchor links in each drop down menu, so I am trying to troubleshoot the General Info menu first. At first the anchor links were scrolling to the incorrect position due to the sticky header/menu, but I fixed that with css code that points the anchor to a location slightly above the section *.anchor { position: relative; top: -160px; }
* However, IF you start at the top of the page and click a link in the dropdown to go to an anchored section on THAT same page, the position is incorrect- it is once again covered by the sticky nav (is something overriding the custom -px code?) For example, if you are at the top of GENERAL INFO and you click on SCHEDULE, the anchor links to the wrong (lower) position on the page. But if you then click on TRAVEL (from SCHEDULE section, or anywhere else on the site other than the top of GENERAL INFO), the anchor links to the correct position. If you are anywhere on the page that is NOT the top (or any other page on the site) the anchor links navigate to the correct position, per the -px code. This is especially troubling if you are navigating to the top of the page (HOW IT WORKS) and then want to go to SCHEDULE or TRAVEL and it keeps scrolling you incorrectly. How can I make the anchor links work correctly from top of the page?The page I need help with: [log in to see the link]
- The topic ‘Anchor links scrolling to incorrect position ONLY if starting at the top of page’ is closed to new replies.