Assuming you want to change CSS after scrolling to a specific point, and then return CSS after scrolling back to a specific point using jQuery:
$(window).scroll(function() { //After scrolling 100px from the top... if ( $(window).scrollTop() >= 100 ) { $('#logo').css('display', 'none'); $('#menuheader').css('margin', '65px auto 0'); //Otherwise remove inline styles and thereby revert to original stying } else { $('#logo, #menuheader').attr('style', ''); } });
Then all you have to do is exchange 100 with any point (the number of pixels on top, and when scrolling) you want the CSS to be replaced by.
http://jsfiddle.net/dJh8w/4/
source share