Jquery delay() function

大城市里の小女人 提交于 2019-11-30 04:48:16

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:

HERE'S A DEMO

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!