2 * jQuery UI Effects Clip 1.11.2
5 * Copyright 2014 jQuery Foundation and other contributors
6 * Released under the MIT license.
7 * http://jquery.org/license
9 * http://api.jqueryui.com/clip-effect/
11 (function( factory ) {
12 if ( typeof define === "function" && define.amd ) {
14 // AMD. Register as an anonymous module.
26 return $.effects.effect.clip = function( o, done ) {
29 props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
30 mode = $.effects.setMode( el, o.mode || "hide" ),
31 show = mode === "show",
32 direction = o.direction || "vertical",
33 vert = direction === "vertical",
34 size = vert ? "height" : "width",
35 position = vert ? "top" : "left",
37 wrapper, animate, distance;
40 $.effects.save( el, props );
44 wrapper = $.effects.createWrapper( el ).css({
47 animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
48 distance = animate[ size ]();
52 animate.css( size, 0 );
53 animate.css( position, distance / 2 );
56 // Create Animation Object:
57 animation[ size ] = show ? distance : 0;
58 animation[ position ] = show ? 0 : distance / 2;
61 animate.animate( animation, {
65 complete: function() {
69 $.effects.restore( el, props );
70 $.effects.removeWrapper( el );