xeon826
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Developing with WordPress
In reply to: Sticky NavigationAh, 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.
Forum: Developing with WordPress
In reply to: Sticky NavigationThat did it, thanks a bunch.
Viewing 2 replies - 1 through 2 (of 2 total)