Fork me on GitHub

jquery-inview by mmoss

A tiny (less than 1kb unminified) jQuery plugin that allows you to specify a callback to execute when an element is scrolled into view. Uses jQuery's Deferred Object API

This is a simple plugin I've thrown together for my blog/personal site. This script can be used to defer the loading of third party plugins, scripts, or anything else you want to so in a callback.

Dependencies

jQuery 1.5+

Authors

Murray Moss (murray@mmoss.name)

Documentation

$.inView()

The $.inView() function, when called will return a new jQuery.Deferred object that will resolve once all elements in the jQuery object have come into view.

Usage Example


var $el = $('#myElement');
$.when($el.inView()).then(function($el){
    alert('#myElement is now in view');
});

Download

You can download this project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://github.com/mmoss/jquery-inview