I have a script which animates a headline. I am trying to make this script fire on page load, but if a user scrolls more than 200px, I'd like this function to stop.
JS:
$(document).scroll(function() {
var scroll = $(this).scrollTop();
if (scroll >= 200) {
$(window).myFunction() return false;
}
else {
$(window).myFunction();
}
});
What is a better way to do this? Currently myFunction won't fire unless I call it from the debugger in the browser dev tools.
Aucun commentaire:
Enregistrer un commentaire