开发者

some problem with fade (jQuery)

开发者 https://www.devze.com 2023-02-15 01:45 出处:网络
I have a simple script with image loading, it doesn\'t work good. Here it is [removed] When we click on a link:

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's href.
  • 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.

0

精彩评论

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