18
|
1 |
/*! |
19
|
2 |
* jQuery UI Effects Drop 1.13.1 |
18
|
3 |
* http://jqueryui.com |
|
4 |
* |
|
5 |
* Copyright jQuery Foundation and other contributors |
|
6 |
* Released under the MIT license. |
|
7 |
* http://jquery.org/license |
|
8 |
*/ |
|
9 |
|
|
10 |
//>>label: Drop Effect |
|
11 |
//>>group: Effects |
|
12 |
//>>description: Moves an element in one direction and hides it at the same time. |
|
13 |
//>>docs: http://api.jqueryui.com/drop-effect/ |
|
14 |
//>>demos: http://jqueryui.com/effect/ |
|
15 |
|
|
16 |
( function( factory ) { |
19
|
17 |
"use strict"; |
|
18 |
|
18
|
19 |
if ( typeof define === "function" && define.amd ) { |
|
20 |
|
|
21 |
// AMD. Register as an anonymous module. |
|
22 |
define( [ |
|
23 |
"jquery", |
|
24 |
"./effect" |
|
25 |
], factory ); |
|
26 |
} else { |
|
27 |
|
|
28 |
// Browser globals |
|
29 |
factory( jQuery ); |
|
30 |
} |
19
|
31 |
} )( function( $ ) { |
|
32 |
"use strict"; |
18
|
33 |
|
|
34 |
return $.effects.define( "drop", "hide", function( options, done ) { |
|
35 |
|
|
36 |
var distance, |
|
37 |
element = $( this ), |
|
38 |
mode = options.mode, |
|
39 |
show = mode === "show", |
|
40 |
direction = options.direction || "left", |
|
41 |
ref = ( direction === "up" || direction === "down" ) ? "top" : "left", |
|
42 |
motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=", |
|
43 |
oppositeMotion = ( motion === "+=" ) ? "-=" : "+=", |
|
44 |
animation = { |
|
45 |
opacity: 0 |
|
46 |
}; |
|
47 |
|
|
48 |
$.effects.createPlaceholder( element ); |
|
49 |
|
|
50 |
distance = options.distance || |
|
51 |
element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2; |
|
52 |
|
|
53 |
animation[ ref ] = motion + distance; |
|
54 |
|
|
55 |
if ( show ) { |
|
56 |
element.css( animation ); |
|
57 |
|
|
58 |
animation[ ref ] = oppositeMotion + distance; |
|
59 |
animation.opacity = 1; |
|
60 |
} |
|
61 |
|
|
62 |
// Animate |
|
63 |
element.animate( animation, { |
|
64 |
queue: false, |
|
65 |
duration: options.duration, |
|
66 |
easing: options.easing, |
|
67 |
complete: done |
|
68 |
} ); |
|
69 |
} ); |
|
70 |
|
19
|
71 |
} ); |