Detect if an element is visible (without using jQuery)
Please see this it's customary seldom code might be useful
<!DOCTYPE html>
<html>
<body>
<div id="one" style="visibility: hidden;">The content of the body element is displayed in your browser.
</div>
<div id="two" style="visibility: visible;"> I'm Cool
</div>
<div onclick="push();"> Click me </div>
<script>
function push() {
a = document.getElementById("one").style.visibility;
alert("one "+a);
b = document.getElementById("two").style.visibility;
alert("one "+b);
}
</script>
</body>
</html>
above code gives the visibility status of the div using it's ID as U required.
Google helped me finding out how jQuery does it, you can do the same:
In jQuery 1.3.2 an element is visible if its browser-reported offsetWidth or offsetHeight is greater than 0.
Release notes
Searching the source code gave me this:
// The way jQuery detect hidden elements, and the isVisible just adds "!".
elem.offsetWidth === 0 && elem.offsetHeight === 0