Simple jQuery plugin to determine if an element is within the viewport. Optional parameters allow the user to specify a minimum percentage of the element's dimensions that must be visible to qualify.
@param x - float values to test against, as a decimal value of how much of the element's width must be visible for the method to return true. defaults to 1 (100%)
@param y - float values to test against, as a decimal value of how much of the element's height must be visible for the method to return true. defaults to 1 (100%)
For example, passing
Usage is simple
$('selector').isOnScreen(); // returns true if element is entirely within the viewport
$('selector').isOnScreen(0.5, 0.5); // returns true if element is at least 50% within the viewport