Check if element is visible.

Small script I wrote that does some rudimentary checks to see if an element is visible in the current view (viewport) of the browser.

As far as I can tell it works perfectly cross-browser. It will check the bounding edges of an element, comparing them with window width and height. It will also mark elements with a width or height of zero as not visible.

Note: the script does not take into account overlapping elements, just checks to see if the element is – theoretically – visible, as it – or at least some of it – is visible in the browser window.