integration/back-office/lib/jquery-ui/ui/jquery.ui.effect-fold.js
changeset 2 78f71aa0a477
parent 1 b95aebb070b5
child 3 54f80d24f469
child 6 547b3ddedf7f
equal deleted inserted replaced
1:b95aebb070b5 2:78f71aa0a477
     1 /*!
       
     2  * jQuery UI Effects Fold 1.10.3
       
     3  * http://jqueryui.com
       
     4  *
       
     5  * Copyright 2013 jQuery Foundation and other contributors
       
     6  * Released under the MIT license.
       
     7  * http://jquery.org/license
       
     8  *
       
     9  * http://api.jqueryui.com/fold-effect/
       
    10  *
       
    11  * Depends:
       
    12  *	jquery.ui.effect.js
       
    13  */
       
    14 (function( $, undefined ) {
       
    15 
       
    16 $.effects.effect.fold = function( o, done ) {
       
    17 
       
    18 	// Create element
       
    19 	var el = $( this ),
       
    20 		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
       
    21 		mode = $.effects.setMode( el, o.mode || "hide" ),
       
    22 		show = mode === "show",
       
    23 		hide = mode === "hide",
       
    24 		size = o.size || 15,
       
    25 		percent = /([0-9]+)%/.exec( size ),
       
    26 		horizFirst = !!o.horizFirst,
       
    27 		widthFirst = show !== horizFirst,
       
    28 		ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
       
    29 		duration = o.duration / 2,
       
    30 		wrapper, distance,
       
    31 		animation1 = {},
       
    32 		animation2 = {};
       
    33 
       
    34 	$.effects.save( el, props );
       
    35 	el.show();
       
    36 
       
    37 	// Create Wrapper
       
    38 	wrapper = $.effects.createWrapper( el ).css({
       
    39 		overflow: "hidden"
       
    40 	});
       
    41 	distance = widthFirst ?
       
    42 		[ wrapper.width(), wrapper.height() ] :
       
    43 		[ wrapper.height(), wrapper.width() ];
       
    44 
       
    45 	if ( percent ) {
       
    46 		size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
       
    47 	}
       
    48 	if ( show ) {
       
    49 		wrapper.css( horizFirst ? {
       
    50 			height: 0,
       
    51 			width: size
       
    52 		} : {
       
    53 			height: size,
       
    54 			width: 0
       
    55 		});
       
    56 	}
       
    57 
       
    58 	// Animation
       
    59 	animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
       
    60 	animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
       
    61 
       
    62 	// Animate
       
    63 	wrapper
       
    64 		.animate( animation1, duration, o.easing )
       
    65 		.animate( animation2, duration, o.easing, function() {
       
    66 			if ( hide ) {
       
    67 				el.hide();
       
    68 			}
       
    69 			$.effects.restore( el, props );
       
    70 			$.effects.removeWrapper( el );
       
    71 			done();
       
    72 		});
       
    73 
       
    74 };
       
    75 
       
    76 })(jQuery);