detect if element is visible on screen code example
Example: 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