The page has a sticky navbar
that stay on screen all the time.
When I am scrolling to the next section(div
) of the page, it will scroll so the div starts at the top of the screen , so the navigation bar cover it a little bit.
How to minus from y scrolling position the navigation bar height ?
$('html, body').animate({
scrollTop: $("#section2").offset().top // minus the nav height
}, 1000);
Also - how to make this navbar
height
available to my javascript (from the css) using a good practice ? (global var?)