author | ymh <ymh.work@gmail.com> |
Mon, 08 Sep 2025 19:44:41 +0200 | |
changeset 23 | 417f20492bf7 |
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 Pulsate 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: Pulsate Effect |
|
11 |
//>>group: Effects |
|
12 |
//>>description: Pulsates an element n times by changing the opacity to zero and back. |
|
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/pulsate-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( "pulsate", "show", function( options, done ) { |
|
36 |
var element = $( this ), |
|
37 |
mode = options.mode, |
|
38 |
show = mode === "show", |
|
39 |
hide = mode === "hide", |
|
40 |
showhide = show || hide, |
|
41 |
||
42 |
// Showing or hiding leaves off the "last" animation |
|
43 |
anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), |
|
44 |
duration = options.duration / anims, |
|
45 |
animateTo = 0, |
|
46 |
i = 1, |
|
47 |
queuelen = element.queue().length; |
|
48 |
||
49 |
if ( show || !element.is( ":visible" ) ) { |
|
50 |
element.css( "opacity", 0 ).show(); |
|
51 |
animateTo = 1; |
|
52 |
} |
|
53 |
||
54 |
// Anims - 1 opacity "toggles" |
|
55 |
for ( ; i < anims; i++ ) { |
|
56 |
element.animate( { opacity: animateTo }, duration, options.easing ); |
|
57 |
animateTo = 1 - animateTo; |
|
58 |
} |
|
59 |
||
60 |
element.animate( { opacity: animateTo }, duration, options.easing ); |
|
61 |
||
62 |
element.queue( done ); |
|
63 |
||
64 |
$.effects.unshift( element, queuelen, anims + 1 ); |
|
65 |
} ); |
|
66 |
||
19 | 67 |
} ); |