diff options
author | gnarf <gnarf@gnarf.net> | 2011-03-04 17:10:02 -0600 |
---|---|---|
committer | gnarf <gnarf@gnarf.net> | 2011-03-04 17:10:02 -0600 |
commit | 2fdc868707d67f9e9df54698395c300d63d75720 (patch) | |
tree | b14e281f7ab4275a4e979cc45b493f6caeeb90d9 /ui/jquery.effects.blind.js | |
parent | 5c4577f78c4db350ebcae1e96698721c0400fb7f (diff) | |
download | jquery-ui-2fdc868707d67f9e9df54698395c300d63d75720.tar.gz jquery-ui-2fdc868707d67f9e9df54698395c300d63d75720.zip |
Effects: General Code Cleanup
Diffstat (limited to 'ui/jquery.effects.blind.js')
-rw-r--r-- | ui/jquery.effects.blind.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/ui/jquery.effects.blind.js b/ui/jquery.effects.blind.js index 4ebba4071..0bf5b0b71 100644 --- a/ui/jquery.effects.blind.js +++ b/ui/jquery.effects.blind.js @@ -15,30 +15,28 @@ $.effects.blind = function(o) { return this.queue(function() { - // Create element var el = $(this), props = ['position','top','bottom','left','right'], mode = $.effects.setMode( el, o.mode || 'hide' ), direction = o.direction || 'vertical', ref = (direction == 'vertical') ? 'height' : 'width', - wrapper, distance; // Default direction + animation = {}, + wrapper, distance; // Adjust $.effects.save(el, props); el.show(); // Save & Show + wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - distance = wrapper[ direction == 'vertical' ? "height" : "width" ](); - if(mode == 'show') wrapper.css(ref, 0); // Shift - // Animation - var animation = {}; - animation[ref] = mode == 'show' ? distance : 0; + animation[ref] = ( mode == 'show' ? wrapper[ ref ]() : 0 ); + (mode == 'show' && wrapper.css(ref, 0)); // start at 0 if we are showing // Animate - wrapper.animate(animation, o.duration, o.easing, function() { - if(mode == 'hide') el.hide(); // Hide + wrapper.animate( animation, o.duration, o.easing, function() { + (mode == 'hide' && el.hide()); // Hide $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.complete) o.complete.apply(el[0], arguments); // Callback + (o.complete && o.complete.apply(el[0], arguments)); // Callback el.dequeue(); }); |