jquery-ui/ui/jquery.effects.blind.js

53 lines
1.2 KiB
JavaScript
Raw Normal View History

/*
* jQuery UI Effects Blind @VERSION
*
2011-01-17 14:13:18 +00:00
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Effects/Blind
*
* Depends:
* jquery.effects.core.js
*/
(function( $, undefined ) {
2008-05-23 09:26:18 +00:00
$.effects.effect.blind = function( o ) {
2011-03-07 00:48:14 +00:00
return this.queue( function() {
2008-05-23 09:26:18 +00:00
// Create element
2011-03-07 00:48:14 +00:00
var el = $( this ),
props = [ 'position', 'top', 'bottom', 'left', 'right' ],
mode = $.effects.setMode( el, o.mode || 'hide' ),
direction = o.direction || 'vertical',
2011-03-06 21:24:24 +00:00
ref = ( direction == 'vertical' ) ? 'height' : 'width',
2011-03-04 23:10:02 +00:00
animation = {},
wrapper, distance;
2011-03-07 00:48:14 +00:00
$.effects.save( el, props );
el.show();
wrapper = $.effects.createWrapper( el ).css({
overflow: 'hidden'
});
animation[ ref ] = ( mode == 'show' ? wrapper[ ref ]() : 0 );
2011-03-07 00:48:14 +00:00
// start at 0 if we are showing
( mode == 'show' && wrapper.css( ref, 0 ) );
// Animate
2011-03-04 23:10:02 +00:00
wrapper.animate( animation, o.duration, o.easing, function() {
2011-03-07 00:48:14 +00:00
( mode == 'hide' && el.hide() );
$.effects.restore( el, props );
$.effects.removeWrapper( el );
$.isFunction( o.complete ) && o.complete.apply( el[ 0 ], arguments );
el.dequeue();
});
});
};
})(jQuery);