animations_css3.js 826 Bytes
Newer Older
Percy Quispe committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/* ------------------------------------------------------------------------------
*
*  # CSS animations
*
*  Specific JS code additions for components_animations.html page
*
*  Version: 1.0
*  Latest update: Aug 1, 2015
*
* ---------------------------------------------------------------------------- */

$(function() {

    // Toggle animations
    $("body").on("click", ".animation", function (e) {

        // Get animation class from "data" attribute
        var animation = $(this).data("animation");

        // Apply animation once per click
        $(this).parents(".panel").addClass("animated " + animation).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function () {
            $(this).removeClass("animated " + animation);
        });
        e.preventDefault();
    });

});