I'm trying to change the color of an element depending on where you are on the site. I have liked it to one anchor point and it is working. But i want it to change color more than one time. Every time it reaches the anchor point #intro i want it to be white and when it reaches the anchor point #portfolio i want it to go black again. How can i make this work?
This is what i have so far:
function scroll_style() {
var window_top = $(window).scrollTop();
var div_top = $('#portfolio').offset().top;
if (window_top > div_top){
$('#nav-icon4 span').css({"background":"#000"});
}
}
$(function() {
$(window).scroll(scroll_style);
scroll_style();
});
else { $('#nav-icon4 span').css({"background":"#FFF"}); }
after yourif
statement?