2020-10-07 12:33:25 -04:00
|
|
|
/*!
|
2024-05-27 17:14:15 -04:00
|
|
|
* jQuery UI Effects Fold 1.13.3
|
|
|
|
* https://jqueryui.com
|
2020-10-07 12:33:25 -04:00
|
|
|
*
|
2024-05-27 17:14:15 -04:00
|
|
|
* Copyright OpenJS Foundation and other contributors
|
2020-10-07 12:33:25 -04:00
|
|
|
* Released under the MIT license.
|
2024-05-27 17:14:15 -04:00
|
|
|
* https://jquery.org/license
|
2020-10-07 12:33:25 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
//>>label: Fold Effect
|
|
|
|
//>>group: Effects
|
|
|
|
//>>description: Folds an element first horizontally and then vertically.
|
2024-05-27 17:14:15 -04:00
|
|
|
//>>docs: https://api.jqueryui.com/fold-effect/
|
|
|
|
//>>demos: https://jqueryui.com/effect/
|
2020-10-07 12:33:25 -04:00
|
|
|
|
|
|
|
( function( factory ) {
|
2021-09-09 20:02:59 -04:00
|
|
|
"use strict";
|
|
|
|
|
2020-10-07 12:33:25 -04:00
|
|
|
if ( typeof define === "function" && define.amd ) {
|
|
|
|
|
|
|
|
// AMD. Register as an anonymous module.
|
|
|
|
define( [
|
|
|
|
"jquery",
|
2024-05-27 17:14:15 -04:00
|
|
|
"../version",
|
|
|
|
"../effect"
|
2020-10-07 12:33:25 -04:00
|
|
|
], factory );
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// Browser globals
|
|
|
|
factory( jQuery );
|
|
|
|
}
|
2021-09-09 20:02:59 -04:00
|
|
|
} )( function( $ ) {
|
|
|
|
"use strict";
|
2020-10-07 12:33:25 -04:00
|
|
|
|
|
|
|
return $.effects.define( "fold", "hide", function( options, done ) {
|
|
|
|
|
|
|
|
// Create element
|
|
|
|
var element = $( this ),
|
|
|
|
mode = options.mode,
|
|
|
|
show = mode === "show",
|
|
|
|
hide = mode === "hide",
|
|
|
|
size = options.size || 15,
|
|
|
|
percent = /([0-9]+)%/.exec( size ),
|
|
|
|
horizFirst = !!options.horizFirst,
|
|
|
|
ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ],
|
|
|
|
duration = options.duration / 2,
|
|
|
|
|
|
|
|
placeholder = $.effects.createPlaceholder( element ),
|
|
|
|
|
|
|
|
start = element.cssClip(),
|
|
|
|
animation1 = { clip: $.extend( {}, start ) },
|
|
|
|
animation2 = { clip: $.extend( {}, start ) },
|
|
|
|
|
|
|
|
distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ],
|
|
|
|
|
|
|
|
queuelen = element.queue().length;
|
|
|
|
|
|
|
|
if ( percent ) {
|
|
|
|
size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
|
|
|
|
}
|
|
|
|
animation1.clip[ ref[ 0 ] ] = size;
|
|
|
|
animation2.clip[ ref[ 0 ] ] = size;
|
|
|
|
animation2.clip[ ref[ 1 ] ] = 0;
|
|
|
|
|
|
|
|
if ( show ) {
|
|
|
|
element.cssClip( animation2.clip );
|
|
|
|
if ( placeholder ) {
|
|
|
|
placeholder.css( $.effects.clipToBox( animation2 ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
animation2.clip = start;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Animate
|
|
|
|
element
|
|
|
|
.queue( function( next ) {
|
|
|
|
if ( placeholder ) {
|
|
|
|
placeholder
|
|
|
|
.animate( $.effects.clipToBox( animation1 ), duration, options.easing )
|
|
|
|
.animate( $.effects.clipToBox( animation2 ), duration, options.easing );
|
|
|
|
}
|
|
|
|
|
|
|
|
next();
|
|
|
|
} )
|
|
|
|
.animate( animation1, duration, options.easing )
|
|
|
|
.animate( animation2, duration, options.easing )
|
|
|
|
.queue( done );
|
|
|
|
|
|
|
|
$.effects.unshift( element, queuelen, 4 );
|
|
|
|
} );
|
|
|
|
|
2021-09-09 20:02:59 -04:00
|
|
|
} );
|