GScroll
GScroll is a lightweight javascript tool to trigger a function when you scroll to a DOM.
Live demo
Getting started
Install with NPM:
$ npm install g-scroll --save
Or use CDN:
https://cdn.rawgit.com/GA-MO/g-scroll/3dede7c2/lib/g-scroll.js
You can download the source as well. :)
Properties:
selector: '.element',
offset: 10,
delay: 0.5,
action: function(selector) {
}
Example:
var dataScroll = [
{
selector: '.element1',
offset: 10,
delay: 0.5,
action: function(selector) {
TweenMax.from(selector, 0.3, { y:100, opacity: 0 });
}
},
{
selector: '.element2',
offset: 10,
delay: 0.5,
action: function(selector) {
alert('Trigger me');
$(selector).addClass('animated');
}
}
];
GScroll(dataScroll);