aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.effects.blind.js
diff options
context:
space:
mode:
authorgnarf <gnarf@gnarf.net>2011-06-21 00:23:52 -0500
committergnarf <gnarf@gnarf.net>2011-06-21 01:18:01 -0500
commit1c1a3b1a361d90a73755fbd038b3cdfb0960c29f (patch)
treef86c98826a6c72421c9bc20b4e75855598bebf34 /ui/jquery.effects.blind.js
parentfb210ae1ec16cefb1e4d4dfaf7d55499cac53ab8 (diff)
downloadjquery-ui-1c1a3b1a361d90a73755fbd038b3cdfb0960c29f.tar.gz
jquery-ui-1c1a3b1a361d90a73755fbd038b3cdfb0960c29f.zip
Effects.*: Updating Effect Method API to avoid duplicating the queue call - Fixes #7318 - Add the queue functions to $.fn.effect()
Diffstat (limited to 'ui/jquery.effects.blind.js')
-rw-r--r--ui/jquery.effects.blind.js112
1 files changed, 54 insertions, 58 deletions
diff --git a/ui/jquery.effects.blind.js b/ui/jquery.effects.blind.js
index b6485b641..8c536be78 100644
--- a/ui/jquery.effects.blind.js
+++ b/ui/jquery.effects.blind.js
@@ -12,73 +12,69 @@
*/
(function( $, undefined ) {
-var rvertical = /up|down|vertical/;
-var rpositivemotion = /up|left|vertical|horizontal/;
+var rvertical = /up|down|vertical/,
+ rpositivemotion = /up|left|vertical|horizontal/;
-$.effects.effect.blind = function( o ) {
+$.effects.effect.blind = function( o, next ) {
+ // 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;
- return this.queue( function() {
-
- // 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 = {},
- 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 ] = ( 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;
+ }
- 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 ( mode === "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();
}
- }
-
- // 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();
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ if ( $.isFunction( o.complete ) ) {
+ o.complete.apply( el[ 0 ], arguments );
}
- });
-
+ next();
+ }
});
};