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

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -