A simple jQuery plugin for firing events when an element reaches defined position on scroll
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
index.html
jquery.reachme.js
jquery.reachme.min.js

README.md

ReachMe

A simple jQuery plugin for firing events when an element reaches defined position on scroll

###DEMO

###Usage

$('.reachit').reachme({
    onReach: function(element) {
        $(element).css('background', 'red');
    },
    onLeave: function(element) {
        $(element).css('background', 'green');
    }
});

###Default Options

from: 'top', // top, middle, bottom
offset: 0, // offset from "from" position, 25px from middle.
duration: 'pin', // 0 will take the height of the element, "pin" will will fire onReach and the onLeave will be fired only when the element will be below the "from" position 
once: false, // "true" onReach/onLeave will fire only once, "false" onReach/onLeave will fire every time you reach or leave the element /// NOT YET ///
container: window, // actually only window
onReach: function(element){}, function fires when the element reaches the "from" position
onLeave: function(element){},