jquery - Change background-color while scrolling -
i background-color of header change background-color of div scrolls past. so, when scrolled div #about (green), background-color of header change green. have far, it's not working. appreciated.
var t = $('#about').offset().top - 100; $(document).scroll(function(){ if($(this).scrolltop() > t) { $('header').css({"background-color":"green"}); } });
check out fiddle.
your code works fine in fiddle after add jquery it. (i used 1.9.1).
Comments
Post a Comment