Fork me on GitHub

appearjs

scroll down

Track the visibility of dom elements and fire user defined callbacks as they appear and disappear.

Demos

Be sure to view the documentation on the project page

Usage

Include appear.js in your page, it has no dependencies.

Call appear() passing in an object with the following:

Example

appear({
  init: function init(){
    console.log('dom is ready');
  },
  elements: function elements(){
    // work with all elements with the class "track"
    return document.getElementsByClassName('track');
  },
  appear: function appear(el){
    console.log('visible', el);
  },
  disappear: function disappear(el){
    console.log('no longer visible', el);
  },
  bounds: 200,
  reappear: true
});

api

appear() will return an object with the following:

Download

source or minified


appear.js logo designed by Magicon from the Noun Project :: Creative Commons - Attribution (CC BY 3.0)