/UPDATE: the most recent version of this plugin is now available on github: https://github.com/moagrius/isOnScreen. Forks (and hopefully improvements) welcome.

/UPDATE: if you’re looking for a how-to on lazy-loading content, images, or event effects, there’s a simple outline using this plugin available here.

Original Version
returns true if any portion of the element is visible in the viewport (considering element’s position and dimension, compared to dimension and scroll position of window). See after for the most recent version, with configurable minimum values.

POC: http://jsfiddle.net/moagrius/wN7ah/

/UPDATE 07.23.14
Extended Version
Here’s an extended version that takes a 2 arguments – float values to test against, as a decimal value of how much of the element must be visible for the method to return true, one value for each axis (x and y).

For example, passing $(element).isOnScreen(0.5, 0.5) would return true if the element had at least 50% of it’s height and width within the viewport rectangle. $(element).isOnScreen(0.1, 0.5) would return true if at least 10% of the width were visible *and* 50% of the height were visible. Omitting an argument (or passing null) defaults to 1 (or 100%).

POC: http://jsfiddle.net/moagrius/RcwJf/2/

If you’re using this for lazy-loading or similar processes in a scroll event, I’d suggest using a debounce or throttle mutator on the handler (scroll events can fire very frequently and negatively impact performance). Here’s my take, and underscore’s.

/UPDATE if you’re only concerned with vertical scrolling, and want to get back a true result if any portion of the element is visible (like most lazy loaders would do), here’s a limited by optimized version:

Vertical Only + Performant Version