diff options
author | gnarf <gnarf@gnarf.net> | 2011-06-21 01:15:42 -0500 |
---|---|---|
committer | gnarf <gnarf@gnarf.net> | 2011-06-21 01:18:11 -0500 |
commit | 65a6c46e5568c43a9df9505e23da6a766814557e (patch) | |
tree | 63087dadabc63382d06c369062644fc64d252f5f /ui/jquery.effects.drop.js | |
parent | 1c1a3b1a361d90a73755fbd038b3cdfb0960c29f (diff) | |
download | jquery-ui-65a6c46e5568c43a9df9505e23da6a766814557e.tar.gz jquery-ui-65a6c46e5568c43a9df9505e23da6a766814557e.zip |
Effects.*: Style Guidance
Diffstat (limited to 'ui/jquery.effects.drop.js')
-rw-r--r-- | ui/jquery.effects.drop.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ui/jquery.effects.drop.js b/ui/jquery.effects.drop.js index a0bdc7d4d..2fba49d92 100644 --- a/ui/jquery.effects.drop.js +++ b/ui/jquery.effects.drop.js @@ -17,11 +17,12 @@ $.effects.effect.drop = function( o, next ) { var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ], mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", direction = o.direction || "left", - ref = ( direction == "up" || direction == "down" ) ? "top" : "left", - motion = ( direction == "up" || direction == "left" ) ? "pos" : "neg", + ref = ( direction === "up" || direction === "down" ) ? "top" : "left", + motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg", animation = { - opacity: mode == "show" ? 1 : 0 + opacity: show ? 1 : 0 }, distance; @@ -32,14 +33,17 @@ $.effects.effect.drop = function( o, next ) { distance = o.distance || el[ ref == "top" ? "outerHeight": "outerWidth" ]({ margin: true }) / 2; - if ( mode == "show" ) { + if ( show ) { el .css( "opacity", 0 ) .css( ref, motion == "pos" ? -distance : distance ); } // Animation - animation[ ref ] = ((mode == "show") ? (motion == "pos" ? "+=" : "-=") : (motion == "pos" ? "-=" : "+=")) + distance; + animation[ ref ] = ( show ? + ( motion === "pos" ? "+=" : "-=" ) : + ( motion === "pos" ? "-=" : "+=" ) ) + + distance; // Animate el.animate( animation, { @@ -50,7 +54,7 @@ $.effects.effect.drop = function( o, next ) { mode == "hide" && el.hide(); $.effects.restore( el, props ); $.effects.removeWrapper( el ); - $.isFunction( o.complete ) && o.complete.apply(this, arguments); + $.isFunction( o.complete ) && o.complete.apply( this, arguments ); next(); } }); |