2 * jQuery UI Effects Clip 1.8.24
4 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
5 * Dual licensed under the MIT or GPL Version 2 licenses.
6 * http://jquery.org/license
8 * http://docs.jquery.com/UI/Effects/Clip
11 * jquery.effects.core.js
13 (function( $, undefined ) {
15 $.effects
.clip = function(o
) {
17 return this.queue(function() {
20 var el
= $(this), props
= ['position','top','bottom','left','right','height','width'];
23 var mode
= $.effects
.setMode(el
, o
.options
.mode
|| 'hide'); // Set Mode
24 var direction
= o
.options
.direction
|| 'vertical'; // Default direction
27 $.effects
.save(el
, props
); el
.show(); // Save & Show
28 var wrapper
= $.effects
.createWrapper(el
).css({overflow
:'hidden'}); // Create Wrapper
29 var animate
= el
[0].tagName
== 'IMG' ? wrapper
: el
;
31 size
: (direction
== 'vertical') ? 'height' : 'width',
32 position
: (direction
== 'vertical') ? 'top' : 'left'
34 var distance
= (direction
== 'vertical') ? animate
.height() : animate
.width();
35 if(mode
== 'show') { animate
.css(ref
.size
, 0); animate
.css(ref
.position
, distance
/ 2); } // Shift
39 animation
[ref
.size
] = mode
== 'show' ? distance
: 0;
40 animation
[ref
.position
] = mode
== 'show' ? 0 : distance
/ 2;
43 animate
.animate(animation
, { queue
: false, duration
: o
.duration
, easing
: o
.options
.easing
, complete: function() {
44 if(mode
== 'hide') el
.hide(); // Hide
45 $.effects
.restore(el
, props
); $.effects
.removeWrapper(el
); // Restore
46 if(o
.callback
) o
.callback
.apply(el
[0], arguments
); // Callback