开发者

Is there a jQuery method that determines whether an element is currently being animated or not in the form of a boolean?

The reason I ask is because I want to disable clicking of a show b开发者_如何学编程utton WHILE the element it is animating is in the process of being animated.


Use the :animated selector:

var isAnimated = $('#button').is(':animated');

http://api.jquery.com/animated-selector/


if($("#someElement").is(":animated")) {
    ...
}

if($("#someElement:animated").length) {
    ...
}

// etc

So you can do:

$("#showBtn").attr("disabled", $("#someElement").is(":animated"));

http://api.jquery.com/animated-selector/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜