onScreen is a jQuery plugin that does stuff when the matched elements are visible (as inside the viewport).
The basic form $('element').onScreen();
will only toggle the onScreen
class on the matched elements. This is optimal for CSS animations. You can set the tolerance
parameter and allow the elements to enter the viewport certain amount of pixels before doing anything.
onScreen also has two methods called doIn()
and, obviously, doOut()
that will execute when the matched elements enter and leave the viewport. It's pretty straight forward. And This plugin can work as a lazy loader for your images, that way you can minimize unnecessary http
requests of content that isn't even visible.
Please login to continue.