javascript check if item is visible code example
Example 1: check if element is visible
.is(':visible')
//Selects all elements that are visible.
if($('#Div').is(':visible')){
// add whatever code you want to run here.
}
$('#yourDiv:visible').callYourFunction();
Example 2: javascript check if element is visible on screen
// Where el is the DOM element you'd like to test for visibility
<script>
function isHidden(el) {
return (el.offsetParent === null);
}
var el = document.getElementById('el');
alert(isHidden(el));
</script>
// if true then element "el" is visible otherwise not visible