Created
June 20, 2016 13:37
-
-
Save ethanclevenger91/632936c1a9ca6088bd767b1468b3121f to your computer and use it in GitHub Desktop.
animate.css jQuery extension using waypoints.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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