some problem with fade (jQuery)
I have a simple script with image loading, it doesn't work good.
Here it is [removed]
When we click on a link:
.block img
removed by fade effect..load
block is showed by fade.block img
src
attribute replaced by link'shref
.- we wait until new image is loaded, then wait 2 more seconds - it is import开发者_如何学Cant part.
- then we remove
.load
and show.block img
by fade
The problem is, when we click on many links, they begin to fadeIn/Out many times.
How do I fix that?
I did what you try to achieve removing the .load()
.
Check here: http://jsfiddle.net/EvXJr/7/
jquery has a handy .stop() function. Alternately you can set a "running" flag when the animation starts and ignore all clicks until it is cleared at the end of the sequence.
精彩评论