Skip to content

Instantly share code, notes, and snippets.

@f4rr3ll1990
Created June 24, 2017 22:18
Show Gist options
  • Save f4rr3ll1990/c2e25d34bd62ae633c12b42fecb4c033 to your computer and use it in GitHub Desktop.
Save f4rr3ll1990/c2e25d34bd62ae633c12b42fecb4c033 to your computer and use it in GitHub Desktop.
Animate CSS + WayPoints javaScript Plugin | https://daneden.github.io/animate.css/
//Animate CSS + WayPoints javaScript Plugin
//Example: $(".element").animated("zoomInUp", "zoomOutDown");
//Author URL: http://webdesign-master.ru
(function($) {
$.fn.animated = function(inEffect, outEffect) {
$(this).css("opacity", "0").addClass("animated").waypoint(function(dir) {
if (dir === "down") {
$(this).removeClass(outEffect).addClass(inEffect).css("opacity", "1");
} else {
$(this).removeClass(inEffect).addClass(outEffect).css("opacity", "1");
};
}, {
offset: "80%"
}).waypoint(function(dir) {
if (dir === "down") {
$(this).removeClass(inEffect).addClass(outEffect).css("opacity", "1");
} else {
$(this).removeClass(outEffect).addClass(inEffect).css("opacity", "1");
};
}, {
offset: -$(window).height()
});
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment