Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f3f415aec1
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (16 sloc) 0.719 kb

VisibilityTracker

Fires an event as elements scroll through the viewport (viewable area of the browser window). Read the VisibilityTracker documentation for more information.

Synopsis

jQuery(document).ready(function(){
    var pEls = document.getElementsByTagName('p');
    jQuery(pEls).bind('visibility-status-change', function(evt, visibilityStatus) {
        if (visibilityStatus.isLastVisible()) {
            jQuery(evt.target).addClass('lastVisible');
        } else {
            jQuery(evt.target).removeClass('lastVisible');
        }
    });
    new VisibilityTracker(pEls);
});
Jump to Line
Something went wrong with that request. Please try again.