2 * jQuery UI Effects Blind 1.9.2
5 * Copyright 2012 jQuery Foundation and other contributors
6 * Released under the MIT license.
7 * http://jquery.org/license
9 * http://api.jqueryui.com/blind-effect/
14 (function( $, undefined ) {
16 var rvertical = /up|down|vertical/,
17 rpositivemotion = /up|left|vertical|horizontal/;
19 $.effects.effect.blind = function( o, done ) {
22 props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
23 mode = $.effects.setMode( el, o.mode || "hide" ),
24 direction = o.direction || "up",
25 vertical = rvertical.test( direction ),
26 ref = vertical ? "height" : "width",
27 ref2 = vertical ? "top" : "left",
28 motion = rpositivemotion.test( direction ),
30 show = mode === "show",
31 wrapper, distance, margin;
33 // if already wrapped, the wrapper's properties are my property. #6245
34 if ( el.parent().is( ".ui-effects-wrapper" ) ) {
35 $.effects.save( el.parent(), props );
37 $.effects.save( el, props );
40 wrapper = $.effects.createWrapper( el ).css({
44 distance = wrapper[ ref ]();
45 margin = parseFloat( wrapper.css( ref2 ) ) || 0;
47 animation[ ref ] = show ? distance : 0;
50 .css( vertical ? "bottom" : "right", 0 )
51 .css( vertical ? "top" : "left", "auto" )
52 .css({ position: "absolute" });
54 animation[ ref2 ] = show ? margin : distance + margin;
57 // start at 0 if we are showing
59 wrapper.css( ref, 0 );
61 wrapper.css( ref2, margin + distance );
66 wrapper.animate( animation, {
70 complete: function() {
71 if ( mode === "hide" ) {
74 $.effects.restore( el, props );
75 $.effects.removeWrapper( el );