The CSS:
#test {
visibility: hidden;
width: 400px;
height: 400px;
background-color: orange;
}
#subTest {
width: 100px;
height: 100px;
background-color: gray;
}
The HTML:
<div id="test">
<div id="subTest"></div>
</div>
The JavaScript:
$(function() {
var test = document.getElementById('test'),
subTest = document.getElementById('subTest');
console.log("getClientRects,length = " + subTest.getClientRects().length);
console.log("offsetParent = " + subTest.offsetParent);
console.log("JQuery isVisible = " + $("#subTest").is(":visible"));
});
The Result:
getClientRects,length = 1
offsetParent = [object HTMLBodyElement]
JQuery isVisible = true
It seems that all methods are ineffective.
So how to check if the #subTest is visible ?