Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 1.12 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  * this uses jquery UI/Effects/switchClass with transitions
  3.  * parameters are:
  4.  * normal: starter class
  5.  * pump: class to transform to
  6.  * interval: time interval
  7.  * stop: if the object hast this stopper class it will break,
  8.  *       you can set the class from the outside
  9.  *      
  10.  * usage: $('.status').pump({normal : 'someclass',
  11.                              pump :  'otherclass',
  12.                              interval : 400,
  13.                              stop : 'doneclass'
  14.                             });
  15.  */
  16. (function($) {
  17. $.fn.pump = function(options){
  18.  if($(this).hasClass(options.stop) == false){
  19.      $(this).animate({opacity:"1.0"}, 0, function() {
  20.                         $(this).switchClass(options.normal,options.pump,options.interval,'easeOutBounce')
  21.                                 .switchClass(options.pump,options.normal,options.interval,'easeOutBounce')
  22.                                 .pump({normal: options.normal,
  23.                                        pump: options.pump,
  24.                                        interval: options.interval,
  25.                                        stop: options.stop});
  26.                         return $(this);
  27.                 });
  28.  }
  29. }
  30. })(jQuery);