1
|
/*!
|
2
|
* jQuery UI Effects Blind 1.9.1
|
3
|
* http://jqueryui.com
|
4
|
*
|
5
|
* Copyright 2012 jQuery Foundation and other contributors
|
6
|
* Released under the MIT license.
|
7
|
* http://jquery.org/license
|
8
|
*
|
9
|
* http://api.jqueryui.com/blind-effect/
|
10
|
*
|
11
|
* Depends:
|
12
|
* jquery.ui.effect.js
|
13
|
*/
|
14
|
(function( $, undefined ) {
|
15
|
|
16
|
var rvertical = /up|down|vertical/,
|
17
|
rpositivemotion = /up|left|vertical|horizontal/;
|
18
|
|
19
|
$.effects.effect.blind = function( o, done ) {
|
20
|
// Create element
|
21
|
var el = $( this ),
|
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 ),
|
29
|
animation = {},
|
30
|
show = mode === "show",
|
31
|
wrapper, distance, margin;
|
32
|
|
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 );
|
36
|
} else {
|
37
|
$.effects.save( el, props );
|
38
|
}
|
39
|
el.show();
|
40
|
wrapper = $.effects.createWrapper( el ).css({
|
41
|
overflow: "hidden"
|
42
|
});
|
43
|
|
44
|
distance = wrapper[ ref ]();
|
45
|
margin = parseFloat( wrapper.css( ref2 ) ) || 0;
|
46
|
|
47
|
animation[ ref ] = show ? distance : 0;
|
48
|
if ( !motion ) {
|
49
|
el
|
50
|
.css( vertical ? "bottom" : "right", 0 )
|
51
|
.css( vertical ? "top" : "left", "auto" )
|
52
|
.css({ position: "absolute" });
|
53
|
|
54
|
animation[ ref2 ] = show ? margin : distance + margin;
|
55
|
}
|
56
|
|
57
|
// start at 0 if we are showing
|
58
|
if ( show ) {
|
59
|
wrapper.css( ref, 0 );
|
60
|
if ( ! motion ) {
|
61
|
wrapper.css( ref2, margin + distance );
|
62
|
}
|
63
|
}
|
64
|
|
65
|
// Animate
|
66
|
wrapper.animate( animation, {
|
67
|
duration: o.duration,
|
68
|
easing: o.easing,
|
69
|
queue: false,
|
70
|
complete: function() {
|
71
|
if ( mode === "hide" ) {
|
72
|
el.hide();
|
73
|
}
|
74
|
$.effects.restore( el, props );
|
75
|
$.effects.removeWrapper( el );
|
76
|
done();
|
77
|
}
|
78
|
});
|
79
|
|
80
|
};
|
81
|
|
82
|
})(jQuery);
|