diff options
author | Rafael Xavier de Souza <rxaviers@gmail.com> | 2013-12-02 16:36:12 -0200 |
---|---|---|
committer | Rafael Xavier de Souza <rxaviers@gmail.com> | 2014-01-24 18:22:49 -0200 |
commit | 21154cfa2e02ef1814a6aff68b14553bdad165cb (patch) | |
tree | 7a6df22c3cb8a1f0060f864e4a2eb241232024a3 /ui/effect-pulsate.js | |
parent | 234f7f3c0e8e0de5b5c194a357e02edc95a83376 (diff) | |
download | jquery-ui-21154cfa2e02ef1814a6aff68b14553bdad165cb.tar.gz jquery-ui-21154cfa2e02ef1814a6aff68b14553bdad165cb.zip |
All: Rename all files, removing the "jquery.ui." prefix;
- By executing https://gist.github.com/jzaefferer/893fcf70b7eebc1dc271;
Fixes #9464
Closes gh-1029
Diffstat (limited to 'ui/effect-pulsate.js')
-rw-r--r-- | ui/effect-pulsate.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/ui/effect-pulsate.js b/ui/effect-pulsate.js new file mode 100644 index 000000000..be0d2a418 --- /dev/null +++ b/ui/effect-pulsate.js @@ -0,0 +1,73 @@ +/*! + * jQuery UI Effects Pulsate @VERSION + * http://jqueryui.com + * + * Copyright 2013 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/pulsate-effect/ + */ +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.pulsate = function( o, done ) { + var elem = $( this ), + mode = $.effects.setMode( elem, o.mode || "show" ), + show = mode === "show", + hide = mode === "hide", + showhide = ( show || mode === "hide" ), + + // 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; + + if ( show || !elem.is(":visible")) { + elem.css( "opacity", 0 ).show(); + animateTo = 1; + } + + // anims - 1 opacity "toggles" + for ( i = 1; i < anims; i++ ) { + elem.animate({ + opacity: animateTo + }, duration, o.easing ); + animateTo = 1 - animateTo; + } + + elem.animate({ + opacity: animateTo + }, duration, o.easing); + + elem.queue(function() { + if ( hide ) { + elem.hide(); + } + done(); + }); + + // 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 ) ) ); + } + elem.dequeue(); +}; + +})); |