I have a site with a header set to position: fixed
. On one of my pages, I use scrollIntoView(true)
on an element. My problem is that when scr
If anybody runs into issues with the top margin of your container div being ignored after a scrollIntoView, then instead of scrolling your element into view, just do a scrollTop relative to its parent scrolling container, as such:
var topOfElementToView= $('#elementToScroll').position().top;
$('#parentScrollingContainer').scrollTop(topOfElementToView);
Got the answer from user113716 on this thread: How to go to a specific element on page?