Created
November 15, 2015 03:33
-
-
Save Niloys7/fe3512da915368d919f3 to your computer and use it in GitHub Desktop.
Trigger action when a user scrolls past a certain part of the page
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
$(window).scroll(function() { | |
var y_scroll_pos = window.pageYOffset; | |
var scroll_pos_test = 500; | |
// set to whatever you want it to be | |
if(y_scroll_pos > scroll_pos_test) { | |
$("body").css("background-color","#000"); | |
} | |
else | |
{ | |
$("body").css("background-color","#FFF"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment