所以我有两个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