Created
October 8, 2014 19:50
-
-
Save jpcontrerasv/081c3e382c3983694284 to your computer and use it in GitHub Desktop.
Si el usuario ha scrolleado cierta cantidad de pixeles
This file contains hidden or 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
var $document = $(document), | |
$element = $('#negro'), | |
className = 'bg-black'; | |
$document.scroll(function() { | |
if ($document.scrollTop() >= 150) { | |
// user scrolled 50 pixels or more; | |
// do stuff | |
$element.addClass(className); | |
} else { | |
$element.removeClass(className); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment