Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #check #element #visible #screen
ADD COMMENT
Topic
Name
5+5 =