Javascript检查元素是否在屏幕上可见

代码示例

0
0

javascript检查元素是否在屏幕上可见

// 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

类似页面

带有示例的类似页面

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................