This demo shows a way to cope with the absence of Scroll offset when the navbar is not Fixed (here it's Sticky), by using a dummy div with an offset declared as a top negative margin equal of the height of the Navbar. The ID is then declared on the dummy div instead of the section.