jQuery.pulse.js

jQuery Pulse Animation Plugin

View the Project on GitHub jsoverson/jquery.pulse.js

Download jquery.pulse.js
Download jquery.pulse.min.js

jQuery Pulse Animation Plugin

The purpose of this plugin was to make it trivial to add subtle visual cues to any web page. JQuery offers plenty in the way of simple effects but this was written to automate successive, identical transitions and the return to the original state.

This is a very light amount of code and, unless something drastic changes to the core of jQuery.animate, it should be future proof for quite some time. It should be as cross browser compatible as jquery is and the examples on this page have been tested on multiple browsers, OSes, and devices.

$('.selector').pulse(css [, options] [, callback]);
   

To stop any given pulse, issue a 'destroy' command on a pulsing element

$('.selector').pulse('destroy');
   

Options


This line of text will pulse red twice quickly


This block will widen 3 times a little more slowly


The same property syntax applies for this as it does with jQuery. For example, you can not use css shorthand. You must specify properties individually.


You can use the interval argument to specify a duration in between the animations. Now breathe deeply!


You can pulse anything jQuery already lets you animate, or much more if you also use jQueryUI!


It also respects jQuery's concept of chaining and operating on multiple elements. (Subsequent chains, though, execute immediately)

This will pulse blue until 'destroy' is called (10 seconds). Subsequent runs of pulse with the same properties will collide and produce unexpected (but often neat) results.

This example uses the callback to chain successive pulses.

This shows the use of the return delay. The background color will pulse between white and purple with 1s delays between all animations

License

Copyright (c) 2012, Jarrod Overson All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JARROD OVERSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.