diff options
Diffstat (limited to 'ui/jquery.effects.blind.js')
-rw-r--r-- | ui/jquery.effects.blind.js | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/ui/jquery.effects.blind.js b/ui/jquery.effects.blind.js index f1b823533..0c865d59f 100644 --- a/ui/jquery.effects.blind.js +++ b/ui/jquery.effects.blind.js @@ -12,33 +12,36 @@ */ (function( $, undefined ) { -$.effects.blind = function(o) { +$.effects.blind = function( o ) { - return this.queue(function() { + return this.queue( function() { // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var direction = o.options.direction || 'vertical'; // Default direction + 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', + animation = {}, + wrapper, distance; + + $.effects.save( el, props ); + el.show(); + wrapper = $.effects.createWrapper( el ).css({ + overflow: 'hidden' + }); - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var ref = (direction == 'vertical') ? 'height' : 'width'; - var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width(); - if(mode == 'show') wrapper.css(ref, 0); // Shift + animation[ ref ] = ( mode == 'show' ? wrapper[ ref ]() : 0 ); - // Animation - var animation = {}; - animation[ref] = mode == 'show' ? distance : 0; + // start at 0 if we are showing + ( mode == 'show' && wrapper.css( ref, 0 ) ); // Animate - wrapper.animate(animation, o.duration, o.options.easing, function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(el[0], arguments); // Callback + wrapper.animate( animation, o.duration, o.easing, function() { + ( mode == 'hide' && el.hide() ); + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + $.isFunction( o.complete ) && o.complete.apply( el[ 0 ], arguments ); el.dequeue(); }); |