Advertisement
Not TestedTesting not done, may not work properly
DOM & HTML

Element Visibility Demonstration

Check element bounding rectangle visibility and viewport placement.

Checking support...
Advertisement

Interactive Input Workspace

Ready for input

Web API Execution Output

Result output will be displayed here after execution...

Native JavaScript Code Example (Zero Libraries)

const rect = element.getBoundingClientRect();
const isVisible = rect.top >= 0 && rect.bottom <= window.innerHeight;

About the Element Visibility Web API

getBoundingClientRect returns the size of an element and its position relative to the viewport.

Specification:W3C & WHATWG Web API Standard
Sponsored Content