开发者

Does jQuery offer an alternative to traditional timer - image swapping

开发者 https://www.devze.com 2023-03-17 06:29 出处:网络
I\'m a jQuery beginner and I\'ve stumbled upon a situation where with traditional JavaScript, I would use a timer and swap 开发者_如何学编程images to produce an animated effect.

I'm a jQuery beginner and I've stumbled upon a situation where with traditional JavaScript, I would use a timer and swap 开发者_如何学编程images to produce an animated effect.

Does jQuery offer any alternative to the traditional JavaScript timer and image-swap animation effect?

(I have around 5 images that I would like to swap every quarter of a second or so)


jQuery.delay()

Set a timer to delay execution of subsequent items in the queue.

use it together with the jQuery.queue

Show the queue of functions to be executed on the matched elements.


Instead of swapping images, you can have them all loaded, but set CSS property "display: none" on all of them, except the one you want to show, for which you would set "display: block".

Another common way of displaying an image is using CSS background-image property, and altering its offset. Historically this has been faster in many browsers than using a set of normal elements!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号