1
Hello!
The script below takes an id image assinatura
and applies an effect on it when my scroll is at a certain site height.
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 400) {
$("#assinatura").addClass("animated jello");
}
});
However, I would like when the scroll reaches 400 or higher, the program to wait 2 seconds to apply the effect I wanted. (2 seconds to test).
So I tried to do the way below, but that resulted in the same thing as the previous one, IE, the program is only running as if I did not hear the setTimeOut:
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 400) {
window.setTimeout($("#assinatura").addClass("animated jello"), 5000);
}
});
I don’t like the idea of you saying "how" to fix but not saying "what’s wrong" and why. The OP will now decorate that have to put the "Function" around your call, and find that it is magic.
– jsbueno
I improved it and added the possibility without the need for
function
.– Inkeliz