jQuery的:this.not(':动画“)及和放大器; that.is(“:可见”)不遵守规则,语法问题?只有code的几行 [英] jquery: this.not (':animated') && that.is (':visible') not following the rules, syntax problem? only few lines of code
本文介绍了jQuery的:this.not(':动画“)及和放大器; that.is(“:可见”)不遵守规则,语法问题?只有code的几行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在#键
点击,它的消力做做点什么
,虽然 .wrapper
的动画和 .wrapper跨度
是不可见的。所以它不是遵守规则。有什么不对?
$('#键')。点击(函数(){
如果(
$('包装')不是(':动画)及和放大器。 $('。包装跨度)是(:可见)
){
//做一点事
}
})
解决方案
在这里,你有一个的工作演示
:
$('#键')。点击(函数(){
如果($('包装:动画)长度大于0)
{
$(包装)文本(动画)。
}
如果(
$('。包装:动画)长度。1){。
$(包装)文本(没有动画)。
}
})
when i click on #button
, it's stilling doing the 'do something'
, even though .wrapper
is animating and .wrapper span
is not visible. so it's not following the rules. what's wrong?
$('#button').click(function(){
if(
$('.wrapper').not(':animated') && $('.wrapper span').is(':visible')
) {
//do something
}
})
解决方案
Here you have a working demo
:
$('#button').click(function(){
if( $('.wrapper:animated').length>0)
{
$(".wrapper").text("animating") ;
}
if(
$('.wrapper:animated').length<1) {
$(".wrapper").text("not animating") ;
}
})
这篇关于jQuery的:this.not(':动画“)及和放大器; that.is(“:可见”)不遵守规则,语法问题?只有code的几行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文