| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
( function( factory ) { |
| 17 |
"use strict"; |
| 18 |
|
| 19 |
if ( typeof define === "function" && define.amd ) { |
| 20 |
|
| 21 |
|
| 22 |
define( [ |
| 23 |
"jquery", |
| 24 |
"../version", |
| 25 |
"../effect" |
| 26 |
], factory ); |
| 27 |
} else { |
| 28 |
|
| 29 |
|
| 30 |
factory( jQuery ); |
| 31 |
} |
| 32 |
} )( function( $ ) { |
| 33 |
"use strict"; |
| 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 |
|
| 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 |
|
| 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 |
|
| 67 |
} ); |