1.0.2 • Published 9 years ago

direction-detection v1.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
9 years ago

direction-detection

Detect whether or not a 'stream\'s' value is increasing or decreasing.

Usage

var directionDetection = require('direction-detection');

// Initialize your object
var scrollDirection = directionDetection({
    onDirectionChange: function(value, direction) {
        console.log('Execute me when the tracked value is changed.')
    }
    , onIncrease: function(value) {
        console.log('Execute me when the tracked value is incremented.')
    }
    , onDecrease: function(value) {
        console.log('Execute me when the tracked value is decremented.')
    }
});

$(window).on('scroll', function() {
    var scrollTop = container.scrollTop();
    scrollDirection.update(scrollTop);
});

Coming Soon

AMD support