Page 1 of 1

JavaScript to Check if Div is in viewport

Posted: 22 Apr 2017, 09:33
by MarPlo
Hello,
How can I check if a Div is in viewport and detect when it exits viewport.
Has anyone a code example or JS script that works in all browsers, on desktop and mobile devices?

JavaScript to Check if Div is in viewport

Posted: 22 Apr 2017, 09:39
by Admin
Try the JavaScript script and example from this page:
https://coursesweb.net/javascript/positi ... wport-html

- It can be used to check if a html element is in viewport, and to get its size and top/left position in page.