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/
精彩评论