Created
December 10, 2013 06:07
-
-
Save jonathan-bird/7886342 to your computer and use it in GitHub Desktop.
Change div background at a certain scroll point
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var fixadent = $(".logo-nav"); //the div you want | |
h = $(window).height(); //calculate height of window or whatever element you want it to scroll past | |
$(window).scroll(function() { | |
if($(this).scrollTop() > h ) { | |
$(fixadent).css('background', '#5fc1d8'); | |
} | |
else { | |
$(fixadent).css('background', '#222'); | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment