author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:52:52 +0200 | |
changeset 22 | 8c2e4d02f4ef |
parent 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
18 | 1 |
/*! |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
2 |
* jQuery UI Effects Drop 1.13.3 |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
3 |
* https://jqueryui.com |
18 | 4 |
* |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
5 |
* Copyright OpenJS Foundation and other contributors |
18 | 6 |
* Released under the MIT license. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
7 |
* https://jquery.org/license |
18 | 8 |
*/ |
9 |
||
10 |
//>>label: Drop Effect |
|
11 |
//>>group: Effects |
|
12 |
//>>description: Moves an element in one direction and hides it at the same time. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
13 |
//>>docs: https://api.jqueryui.com/drop-effect/ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
14 |
//>>demos: https://jqueryui.com/effect/ |
18 | 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", |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
24 |
"../version", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
25 |
"../effect" |
18 | 26 |
], factory ); |
27 |
} else { |
|
28 |
||
29 |
// Browser globals |
|
30 |
factory( jQuery ); |
|
31 |
} |
|
19 | 32 |
} )( function( $ ) { |
33 |
"use strict"; |
|
18 | 34 |
|
35 |
return $.effects.define( "drop", "hide", function( options, done ) { |
|
36 |
||
37 |
var distance, |
|
38 |
element = $( this ), |
|
39 |
mode = options.mode, |
|
40 |
show = mode === "show", |
|
41 |
direction = options.direction || "left", |
|
42 |
ref = ( direction === "up" || direction === "down" ) ? "top" : "left", |
|
43 |
motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=", |
|
44 |
oppositeMotion = ( motion === "+=" ) ? "-=" : "+=", |
|
45 |
animation = { |
|
46 |
opacity: 0 |
|
47 |
}; |
|
48 |
||
49 |
$.effects.createPlaceholder( element ); |
|
50 |
||
51 |
distance = options.distance || |
|
52 |
element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2; |
|
53 |
||
54 |
animation[ ref ] = motion + distance; |
|
55 |
||
56 |
if ( show ) { |
|
57 |
element.css( animation ); |
|
58 |
||
59 |
animation[ ref ] = oppositeMotion + distance; |
|
60 |
animation.opacity = 1; |
|
61 |
} |
|
62 |
||
63 |
// Animate |
|
64 |
element.animate( animation, { |
|
65 |
queue: false, |
|
66 |
duration: options.duration, |
|
67 |
easing: options.easing, |
|
68 |
complete: done |
|
69 |
} ); |
|
70 |
} ); |
|
71 |
||
19 | 72 |
} ); |