Good-as-hell scroll animations.
Create your animation by specifiying the target element an animation function:
var animation = new ScrollAnimation({
el: document.body,
animation: function(scrollTop, windowHeight, documentHeight) {
// Do stuff...
}
});
And register your new animation:
ScrollAnimation.register(animation);
You can register as many animations as you like. Finally you need to tell
ScrollAnimation
to begin, typically you'd want to do this on DOMReady or
window load:
ScrollAnimation.start();
Hell yeah!
Animations can also remove themselves so they're no longer called. You might opt to do this once an animation is complete:
ScrollAnimation.remove(animation);
Simply include scroll_animation after jQuery:
<script src="/javascripts/scroll_animation.js"></script>
bower install scroll_animation