所以我有兩個div,我想看看都是目前hidden..Im相信這是真的很容易,但林失去了一些原因檢查,看看如果兩個ID的是隱藏在條件
我有這個
$j('.btn').click(function(){
//check to see if the divs are currently hidden and if they are show either one of the two
});
所以我有兩個div,我想看看都是目前hidden..Im相信這是真的很容易,但林失去了一些原因檢查,看看如果兩個ID的是隱藏在條件
我有這個
$j('.btn').click(function(){
//check to see if the divs are currently hidden and if they are show either one of the two
});
您可以使用jQuery的:hidden
help僞與.is()
help方法一起。
$j('.btn').click(function(){
var $div1 = $('div.THEDIV'),
$div2 = $('div.OTHERDIV');
if($div1.is(':hidden') && $div2.is(':hidden')) {
$div1.show();
}
});
$('.btn').click(function(){
var size = $('div#someID').add('div#someOtherID').filter(function(){
return ($(this).css('display') == 'none' || $(this).css('visibility') == 'hidden');
}).size();
if (size == 2) {
// do your thang baby
}
});
使用$('#div_1').is(':visible')
if($('.one:hidden') && $('.two:hidden')) {
$('.btn').click(function(){
$('.one, .two').show();
});
}
<a href="#" class="btn">link</a>
<div class="one">One</div>
<div class="two">Two</div>
能行嗎?
當它 - 即將提交,當你的答案出現了。 +1 – JasCav 2011-02-11 15:20:41