diff options
author | gnarf <gnarf@gnarf.net> | 2011-06-21 00:23:52 -0500 |
---|---|---|
committer | gnarf <gnarf@gnarf.net> | 2011-06-21 01:18:01 -0500 |
commit | 1c1a3b1a361d90a73755fbd038b3cdfb0960c29f (patch) | |
tree | f86c98826a6c72421c9bc20b4e75855598bebf34 /ui/jquery.effects.slide.js | |
parent | fb210ae1ec16cefb1e4d4dfaf7d55499cac53ab8 (diff) | |
download | jquery-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.slide.js')
-rw-r--r-- | ui/jquery.effects.slide.js | 90 |
1 files changed, 43 insertions, 47 deletions
diff --git a/ui/jquery.effects.slide.js b/ui/jquery.effects.slide.js index ccb13fa1b..7ed744284 100644 --- a/ui/jquery.effects.slide.js +++ b/ui/jquery.effects.slide.js @@ -12,58 +12,54 @@ */ (function( $, undefined ) { -$.effects.effect.slide = function( o ) { +$.effects.effect.slide = function( o, next ) { - return this.queue( function() { + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "width", "height" ], + mode = $.effects.setMode( el, o.mode || "show" ), + direction = o.direction || "left", + ref = (direction == "up" || direction == "down") ? "top" : "left", + motion = (direction == "up" || direction == "left") ? "pos" : "neg", + distance, + animation = {}, + size; - // Create element - var el = $( this ), - props = [ "position", "top", "bottom", "left", "right", "width", "height" ], - mode = $.effects.setMode( el, o.mode || 'show' ), - direction = o.direction || 'left', - ref = (direction == 'up' || direction == 'down') ? 'top' : 'left', - motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg', - distance, - animation = {}, - size; - - // Adjust - $.effects.save( el, props ); - el.show(); - distance = o.distance || el[ ref == 'top' ? "outerHeight" : "outerWidth" ]({ - margin: true - }); - - $.effects.createWrapper( el ).css({ - overflow: 'hidden' - }); - - if (mode == 'show') { - el.css( ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance ); - } + // Adjust + $.effects.save( el, props ); + el.show(); + distance = o.distance || el[ ref == "top" ? "outerHeight" : "outerWidth" ]({ + margin: true + }); + + $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + + if (mode == "show") { + el.css( ref, motion == "pos" ? (isNaN(distance) ? "-" + distance : -distance) : distance ); + } - // Animation - animation[ ref ] = ( mode == 'show' ? - (motion == 'pos' ? '+=' : '-=') : - (motion == 'pos' ? '-=' : '+=')) - + distance; + // Animation + animation[ ref ] = ( mode == "show" ? + (motion == "pos" ? "+=" : "-=") : + (motion == "pos" ? "-=" : "+=")) + + distance; - // Animate - el.animate( animation, { - queue: false, - duration: o.duration, - easing: o.easing, - complete: function() { - if ( mode == 'hide' ) { - el.hide(); - } - $.effects.restore( el, props ); - $.effects.removeWrapper( el ); - $.isFunction(o.complete) && o.complete.apply( this, arguments ); - el.dequeue(); + // Animate + el.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( mode == "hide" ) { + el.hide(); } - }); - + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + $.isFunction(o.complete) && o.complete.apply( this, arguments ); + next(); + } }); }; |