diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-07-25 11:53:14 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-07-25 11:53:14 -0400 |
commit | 19a9de7e668cdb3b76c3b733d0147f1853cb38a5 (patch) | |
tree | a259b421dd77cbec27e55db9b4d1104bf5214a2a /ui/jquery.effects.blind.js | |
parent | daadc343be2f139e82719e2e5ff466aa19ec166f (diff) | |
parent | 51ee3be39829e339c8e4bccb532347944e600ca5 (diff) | |
download | jquery-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.blind.js')
-rw-r--r-- | ui/jquery.effects.blind.js | 109 |
1 files changed, 51 insertions, 58 deletions
diff --git a/ui/jquery.effects.blind.js b/ui/jquery.effects.blind.js index 8ef544faa..5f86bed7b 100644 --- a/ui/jquery.effects.blind.js +++ b/ui/jquery.effects.blind.js @@ -11,74 +11,67 @@ * jquery.effects.core.js */ (function( $, undefined ) { - -var rvertical = /up|down|vertical/; -var rpositivemotion = /up|left|vertical|horizontal/; -$.effects.effect.blind = function( o ) { +var rvertical = /up|down|vertical/, + rpositivemotion = /up|left|vertical|horizontal/; - return this.queue( function() { +$.effects.effect.blind = function( o, done ) { + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + direction = o.direction || "up", + vertical = rvertical.test( direction ), + ref = vertical ? "height" : "width", + ref2 = vertical ? "top" : "left", + motion = rpositivemotion.test( direction ), + animation = {}, + show = mode === "show", + wrapper, distance; - // Create element - var el = $( this ), - props = [ "position", "top", "bottom", "left", "right" ], - mode = $.effects.setMode( el, o.mode || "hide" ), - direction = o.direction || "up", - vertical = rvertical.test( direction ), - ref = vertical ? "height" : "width", - ref2 = vertical ? "top" : "left", - motion = rpositivemotion.test( direction ), - animation = {}, - wrapper, distance; + // if already wrapped, the wrapper's properties are my property. #6245 + if ( el.parent().is( ".ui-effects-wrapper" ) ) { + $.effects.save( el.parent(), props ); + } else { + $.effects.save( el, props ); + } + el.show(); + wrapper = $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); - // if already wrapped, the wrapper's properties are my property. #6245 - if ( el.parent().is( ".ui-effects-wrapper" ) ) { - $.effects.save( el.parent(), props ); - } else { - $.effects.save( el, props ); - } - el.show(); - wrapper = $.effects.createWrapper( el ).css({ - overflow: "hidden" - }); + distance = wrapper[ ref ](); - distance = wrapper[ ref ](); + animation[ ref ] = show ? distance : 0; + if ( !motion ) { + el + .css( vertical ? "bottom" : "right", 0 ) + .css( vertical ? "top" : "left", "" ) + .css({ position: "absolute" }); + animation[ ref2 ] = show ? 0 : distance; + } - animation[ ref ] = ( mode === "show" ? distance : 0 ); - if ( !motion ) { - el - .css( vertical ? "bottom" : "right", 0 ) - .css( vertical ? "top" : "left", "" ) - .css({ position: "absolute" }); - animation[ ref2 ] = ( mode === "show" ) ? 0 : distance; + // start at 0 if we are showing + if ( show ) { + wrapper.css( ref, 0 ); + if ( ! motion ) { + wrapper.css( ref2, distance ); } + } - // start at 0 if we are showing - if ( mode == "show" ) { - wrapper.css( ref, 0 ); - if ( ! motion ) { - wrapper.css( ref2, distance ); + // Animate + wrapper.animate( animation, { + duration: o.duration, + easing: o.easing, + queue: false, + complete: function() { + if ( mode === "hide" ) { + el.hide(); } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); } - - // Animate - wrapper.animate( animation, { - duration: o.duration, - easing: o.easing, - queue: false, - complete: function() { - if ( mode == "hide" ) { - el.hide(); - } - $.effects.restore( el, props ); - $.effects.removeWrapper( el ); - if ( $.isFunction( o.complete ) ) { - o.complete.apply( el[ 0 ], arguments ); - } - el.dequeue(); - } - }); - }); }; |