<div id="navbar"> ... </div>
<div id="mainpage" style="height: 100vh;"> ... </div>
<div id="footer"> ... </div>
when the page is ready, i want the jquery to scroll out the complete navbar div, for this,
i am currently using -
$(document).ready(function(){
var navHeight = $('#navbar').height();
console.log(navHeight);
$('body,html').animate({scrollTop: navHeight}, 400);
})
this only lefts some portion of navbar in view, there is enough area left in footer to scroll.
i dont now why is this happening
Use this it may help you.
$(document).ready(function(){
var navHeight = $('#navbar').css("height","100%");
console.log(navHeight);
$('body,html').animate({scrollTop: navHeight}, 400);
})