aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.effects.clip.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-07-25 11:53:14 -0400
committerScott González <scott.gonzalez@gmail.com>2011-07-25 11:53:14 -0400
commit19a9de7e668cdb3b76c3b733d0147f1853cb38a5 (patch)
treea259b421dd77cbec27e55db9b4d1104bf5214a2a /ui/jquery.effects.clip.js
parentdaadc343be2f139e82719e2e5ff466aa19ec166f (diff)
parent51ee3be39829e339c8e4bccb532347944e600ca5 (diff)
downloadjquery-ui-19a9de7e668cdb3b76c3b733d0147f1853cb38a5.tar.gz
jquery-ui-19a9de7e668cdb3b76c3b733d0147f1853cb38a5.zip
Merge branch 'master' into core-1.6.1
Conflicts: demos/menubar/default.html tests/unit/autocomplete/autocomplete.html tests/visual/effects/effects.all.html ui/jquery.ui.menu.js ui/jquery.ui.popup.js
Diffstat (limited to 'ui/jquery.effects.clip.js')
-rw-r--r--ui/jquery.effects.clip.js85
1 files changed, 41 insertions, 44 deletions
diff --git a/ui/jquery.effects.clip.js b/ui/jquery.effects.clip.js
index 14b358dfa..c6eecc671 100644
--- a/ui/jquery.effects.clip.js
+++ b/ui/jquery.effects.clip.js
@@ -12,56 +12,53 @@
*/
(function( $, undefined ) {
-$.effects.effect.clip = function( o ) {
+$.effects.effect.clip = function( o, done ) {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ direction = o.direction || "vertical",
+ vert = direction === "vertical",
+ size = vert ? "height" : "width",
+ position = vert ? "top" : "left",
+ animation = {},
+ wrapper, animate, distance;
- return this.queue( function() {
+ // Save & Show
+ $.effects.save( el, props );
+ el.show();
- // Create element
- var el = $( this ),
- props = ['position','top','bottom','left','right','height','width'],
- mode = $.effects.setMode( el, o.mode || 'hide' ),
- direction = o.direction || 'vertical',
- ref = {
- size: (direction == 'vertical') ? 'height' : 'width',
- position: (direction == 'vertical') ? 'top' : 'left'
- },
- animation = {},
- wrapper, animate, distance;
-
- // Save & Show
- $.effects.save( el, props ); el.show();
-
- // Create Wrapper
- wrapper = $.effects.createWrapper( el ).css({
- overflow: 'hidden'
- });
- animate = ( el[0].tagName == 'IMG' ) ? wrapper : el;
- distance = animate[ ref.size ]();
+ // Create Wrapper
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+ animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
+ distance = animate[ size ]();
- // Shift
- if ( mode == 'show' ) {
- animate.css( ref.size, 0 );
- animate.css( ref.position, distance / 2 );
- }
+ // Shift
+ if ( show ) {
+ animate.css( size, 0 );
+ animate.css( position, distance / 2 );
+ }
- // Create Animation Object:
- animation[ ref.size ] = mode == 'show' ? distance : 0;
- animation[ ref.position ] = mode == 'show' ? 0 : distance / 2;
+ // Create Animation Object:
+ animation[ size ] = show ? distance : 0;
+ animation[ position ] = show ? 0 : distance / 2;
- // Animate
- animate.animate( animation, {
- queue: false,
- duration: o.duration,
- easing: o.easing,
- complete: function() {
- mode == 'hide' && el.hide();
- $.effects.restore( el, props );
- $.effects.removeWrapper( el );
- $.isFunction( o.complete ) && o.complete.apply( el[ 0 ], arguments );
- el.dequeue();
+ // Animate
+ animate.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( !show ) {
+ el.hide();
}
- });
-
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
});
};