2012-02-27 00:49:51 +00:00
|
|
|
/*!
|
2008-09-04 22:03:30 +00:00
|
|
|
* jQuery UI Effects Pulsate @VERSION
|
2008-06-06 20:08:52 +00:00
|
|
|
*
|
2012-03-08 15:53:08 +00:00
|
|
|
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
|
2010-07-09 13:01:04 +00:00
|
|
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
|
|
* http://jquery.org/license
|
2008-11-20 04:10:34 +00:00
|
|
|
*
|
2008-06-06 20:08:52 +00:00
|
|
|
* http://docs.jquery.com/UI/Effects/Pulsate
|
|
|
|
*
|
|
|
|
* Depends:
|
2009-09-17 10:39:12 +00:00
|
|
|
* jquery.effects.core.js
|
2008-06-06 20:08:52 +00:00
|
|
|
*/
|
2010-07-13 13:57:58 +00:00
|
|
|
(function( $, undefined ) {
|
2008-06-04 02:34:33 +00:00
|
|
|
|
2011-06-21 06:11:46 +00:00
|
|
|
$.effects.effect.pulsate = function( o, done ) {
|
2011-06-21 05:23:52 +00:00
|
|
|
var elem = $( this ),
|
|
|
|
mode = $.effects.setMode( elem, o.mode || "show" ),
|
|
|
|
show = mode === "show",
|
|
|
|
hide = mode === "hide",
|
|
|
|
showhide = ( show || mode === "hide" ),
|
2011-03-27 11:30:40 +00:00
|
|
|
|
2011-06-21 05:23:52 +00:00
|
|
|
// showing or hiding leaves of the "last" animation
|
|
|
|
anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
|
|
|
|
duration = o.duration / anims,
|
|
|
|
animateTo = 0,
|
|
|
|
queue = elem.queue(),
|
|
|
|
queuelen = queue.length,
|
|
|
|
i;
|
2009-11-16 02:49:36 +00:00
|
|
|
|
2011-06-21 05:23:52 +00:00
|
|
|
if ( show || !elem.is(":visible")) {
|
|
|
|
elem.css( "opacity", 0 ).show();
|
|
|
|
animateTo = 1;
|
|
|
|
}
|
2008-11-18 02:55:25 +00:00
|
|
|
|
2011-06-21 05:23:52 +00:00
|
|
|
// anims - 1 opacity "toggles"
|
|
|
|
for ( i = 1; i < anims; i++ ) {
|
2011-05-01 08:44:33 +00:00
|
|
|
elem.animate({
|
|
|
|
opacity: animateTo
|
2011-06-21 05:23:52 +00:00
|
|
|
}, duration, o.easing );
|
|
|
|
animateTo = 1 - animateTo;
|
|
|
|
}
|
2011-05-10 21:25:08 +00:00
|
|
|
|
2011-06-21 05:23:52 +00:00
|
|
|
elem.animate({
|
|
|
|
opacity: animateTo
|
|
|
|
}, duration, o.easing);
|
2011-03-27 11:30:40 +00:00
|
|
|
|
2011-06-21 06:11:46 +00:00
|
|
|
elem.queue(function() {
|
2011-06-21 05:23:52 +00:00
|
|
|
if ( hide ) {
|
|
|
|
elem.hide();
|
|
|
|
}
|
2011-06-21 06:11:46 +00:00
|
|
|
done();
|
2009-11-16 02:49:36 +00:00
|
|
|
});
|
2011-06-21 05:23:52 +00:00
|
|
|
|
|
|
|
// We just queued up "anims" animations, we need to put them next in the queue
|
|
|
|
if ( queuelen > 1 ) {
|
|
|
|
queue.splice.apply( queue,
|
|
|
|
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
|
|
|
|
}
|
2011-06-21 06:11:46 +00:00
|
|
|
elem.dequeue();
|
2008-06-06 19:47:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
})(jQuery);
|