look here: http://jsfiddle.net/1L5y559z/
Let's say I want to change the body's background color when someone scroll past or below div 1, how would I do that with jquery if it can?
I know there's this:
$(window).scroll(function() {
var y_scroll_pos = window.pageYOffset;
var scroll_pos_test = 100;
if(y_scroll_pos > scroll_pos_test) {
$("body").css("background-color","black");
}
else
{
$("body").css("background-color","white");
}
});
But it's for when you scroll past or below a specific number pixel. I'm trying to get the same thing for a specific div instead.