In JQuery is there a way to queue effects to occur after a time limit has expired?
I'm trying to create a message notification for a web开发者_Python百科 page using jQuery. The message will slide up from the bottom and then after 10 seconds slide back down. The problem is that I would like to setup the timing through the jQuery effects system if possible, rather than using setTimeout
s. Which is a rather inelegant solution?
How do you use jQuery to queue up effects to happen after certain time intervals?
You can use delay function along with animation. Check this URL: http://api.jquery.com/delay/
You could use the delay function.
But ideally I would manage my own queue, invoking the next message when the current message closes (using the complete callback no setTimeout
required)
You could always use the callback on .animate() too to queue subsequent animations http://api.jquery.com/animate/
The callback will fire whenever the animation is complete.
精彩评论