2 * jQuery UI Effects Fold 1.9.2
5 * Copyright 2012 jQuery Foundation and other contributors
6 * Released under the MIT license.
7 * http://jquery.org/license
9 * http://api.jqueryui.com/fold-effect/
14 (function( $, undefined ) {
16 $.effects.effect.fold = function( o, done ) {
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",
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,
34 $.effects.save( el, props );
38 wrapper = $.effects.createWrapper( el ).css({
41 distance = widthFirst ?
42 [ wrapper.width(), wrapper.height() ] :
43 [ wrapper.height(), wrapper.width() ];
46 size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
49 wrapper.css( horizFirst ? {
59 animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
60 animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
64 .animate( animation1, duration, o.easing )
65 .animate( animation2, duration, o.easing, function() {
69 $.effects.restore( el, props );
70 $.effects.removeWrapper( el );