animations_velocity_basic.js 1.27 KB
Newer Older
Luis Gangas 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
/* ------------------------------------------------------------------------------
*
*  # Basic Velocity.js animations
*
*  Specific JS code additions for extension_velocity_basic.html page
*
*  Version: 1.0
*  Latest update: Aug 1, 2015
*
* ---------------------------------------------------------------------------- */

$(function() {

    // Run basic animations
    $('.velocity-property').on('click', function (e) {
        e.preventDefault();
        
        // Get animation class and panel
        var property = $(this).data("property");
        var value = $(this).data("value");

        var property2 = $(this).data("property2");
        var value2 = $(this).data("value2");

        var property3 = $(this).data("property3");
        var value3 = $(this).data("value3");

        // Add options
		var animateMap = {},
		animateOptions = {
			easing: 'easeInOut',
			duration: 250
		};
		animateMap[property] = value;
		animateMap[property2] = value2;
		animateMap[property3] = value3;


        // Add animation class to panel element
        $(this).parents(".demo-velocity-box")
        .velocity(animateMap, animateOptions)
        .velocity("reverse", {
        	delay: 1000,
        	complete: function() {
        		$(this).removeAttr('style');
        	}
        });
    });
    
});