开发者

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

开发者 https://www.devze.com 2023-02-01 07:16 出处:网络
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:

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

精彩评论

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