aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.effects.slide.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.slide.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.slide.js')
-rw-r--r--ui/jquery.effects.slide.js88
1 files changed, 43 insertions, 45 deletions
diff --git a/ui/jquery.effects.slide.js b/ui/jquery.effects.slide.js
index 6b0296754..de393c779 100644
--- a/ui/jquery.effects.slide.js
+++ b/ui/jquery.effects.slide.js
@@ -12,56 +12,54 @@
*/
(function( $, undefined ) {
-$.effects.effect.slide = function( o ) {
+$.effects.effect.slide = function( o, done ) {
- return this.queue( function() {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
+ mode = $.effects.setMode( el, o.mode || "show" ),
+ show = mode === "show",
+ direction = o.direction || "left",
+ ref = (direction == "up" || direction == "down") ? "top" : "left",
+ positiveMotion = (direction == "up" || direction == "left"),
+ distance,
+ animation = {},
+ size;
- // Create element
- var el = $( this ),
- props = ['position','top','bottom','left','right'],
- 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 = {};
-
- // Adjust
- $.effects.save( el, props );
- el.show();
- $.effects.createWrapper( el ).css({
- overflow: 'hidden'
- });
-
- distance = o.distance || el[ ref == 'top' ? "outerHeight" : "outerWidth" ]({
- margin: true
- });
- 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 ( show ) {
+ el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
+ }
- // Animation
- animation[ ref ] = ( mode == 'show' ?
- (motion == 'pos' ? '+=' : '-=') :
- (motion == 'pos' ? '-=' : '+='))
- + distance;
+ // Animation
+ animation[ ref ] = ( show ?
+ ( positiveMotion ? "+=" : "-=") :
+ ( positiveMotion ? "-=" : "+="))
+ + 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 );
+ done();
+ }
});
};