淡入和淡出重复 [英] FadeIn and fadeOut repeat

查看:132
本文介绍了淡入和淡出重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我快速单击#div几次时,fadeIn和fadeOut会执行几次.我想不要重复动画,如果我快速单击#div动画仅执行一次.

When I quickly click a #div several times, fadeIn and fadeOut is performed several times. I would like the animation is not repeated, if I quickly click #div animation perform only one time.

代码:

$("#div").click(function(){
    $("#information").fadeIn(1200).fadeOut(1200);
});

对不起,我的英语;)

推荐答案

尝试使用.stop()

$("#information").stop(true, true).fadeIn(1200).fadeOut(1200);

演示---> http://jsfiddle.net/S48RU/

这篇关于淡入和淡出重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆