FadeIn and fadeOut repeat

99封情书 提交于 2019-12-11 19:29:55

问题


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.

Code:

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

Sorry for my english ;)


回答1:


Try using .stop()

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

Demo ---> http://jsfiddle.net/S48RU/



来源:https://stackoverflow.com/questions/16751458/fadein-and-fadeout-repeat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!