Add padding to the top of your main content area that’s the same number of pixels as your navbar eats up.
That did it, thanks a bunch.
Ah, I might’ve jinxed it. I editted the jQuery to look like this
<script>
;(function($){
var mn = $(".menu");
mns = "main-nav-scrolled";
hdr = $('header').height();
$(window).scroll(function() {
if( $(this).scrollTop() > hdr ) {
$(".site-content").attr('style', 'padding-top: 100px !important');
} else {
$(".site-content").attr('style', 'padding-top: 0px //!important');
mn.removeClass(mns);
}
});
})(jQuery);
Fixed it: just added 50 px padding to the else block.
</script>
This almost functions well but the thing is, the “else” block doesn’t load until there’s a scroll event. (I guess the jQuery doesn’t launch until something happens) so I’m trying to find out how to possibly run the jQuery before the page loads. As it is, what happens is that, the page loads and the once there’s at least a small bit of scrolling, the else block is launched. Currently I’m using a WP Header/Footer Plugin for loading the scripts. Maybe they have to be loaded another way?
Edit: fixed it, just added 50px padding to the else block.
-
This reply was modified 9 years, 2 months ago by
xeon826.
-
This reply was modified 9 years, 2 months ago by
xeon826.
-
This reply was modified 9 years, 2 months ago by
xeon826. Reason: Solved