I have Jquery code to fade certain divs when the page loads. how would i edit this code to trigger this when the user scrolls 2000px on my webpage.
JQUERY
$(function () { $(window).load(function() {
$('.welcome-image').addClass('animated fadeInRightBig');
})
var reset = function reset() {
console.log($(this).scrollTop());
// do stuff when window `.scrollTop()` > 75
if ($(this).scrollTop() > 2000) {
// turn off scroll event so `fx` not called
// during ongoing animation
$(this).off("scroll");
// when all animations complete
fx()
}
};
// if `fx` should only be called once ,
// change `.on()` to `.one()` ,
// remove `.then()` callback following `fx()`
// within `reset`
$(window).on("scroll", reset);
});