Skip to content

Instantly share code, notes, and snippets.

@ethanclevenger91
Created June 20, 2016 13:37
Show Gist options
  • Save ethanclevenger91/632936c1a9ca6088bd767b1468b3121f to your computer and use it in GitHub Desktop.
Save ethanclevenger91/632936c1a9ca6088bd767b1468b3121f to your computer and use it in GitHub Desktop.
animate.css jQuery extension using waypoints.js
window.jQuery.fn.extend({
animateCss: function (animationName, delay, offset) {
var offset = typeof offset !== 'undefined' ? offset : '70%';
var delay = typeof delay !== 'undefined' ? delay : 0;
var $this = $(this);
$this.css('visibility', 'hidden');
new Waypoint({
element:this[0],
handler:function(direction) {
setTimeout(function() {
$this.addClass('animated '+animationName).css('visibility', 'visible');
}, delay);
},
offset: offset
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment