I have some jquery and am trying to apply a delay to it but can\'t seem to get it to work.
The current jquery is as follows...
image.css({\"visibilit
The delay()
function only applies to actions queued on the element. Most commonly, but not always, these are actions created by the animate()
method. In this case, use setTimeout
to run some code after a specified interval.
Try this:
setTimeout(function() {
image.css({"visibility" : "hidden"}).removeClass("image-background");
}, 800);
.delay()
is not only for animations.
It's for anything in a queue
.
image.delay(800)
.queue(function( nxt ) {
$(this).css({"visibility":"hidden"}).removeClass("image-background");
nxt(); // continue the queue
});
For the down voter: