Created
July 23, 2011 15:11
-
-
Save ivoba/1101530 to your computer and use it in GitHub Desktop.
jquery pump effect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* this uses jquery UI/Effects/switchClass with transitions | |
* parameters are: | |
* normal: starter class | |
* pump: class to transform to | |
* interval: time interval | |
* stop: if the object hast this stopper class it will break, | |
* you can set the class from the outside | |
* | |
* usage: $('.status').pump({normal : 'someclass', | |
pump : 'otherclass', | |
interval : 400, | |
stop : 'doneclass' | |
}); | |
*/ | |
(function($) { | |
$.fn.pump = function(options){ | |
if($(this).hasClass(options.stop) == false){ | |
$(this).animate({opacity:"1.0"}, 0, function() { | |
$(this).switchClass(options.normal,options.pump,options.interval,'easeOutBounce') | |
.switchClass(options.pump,options.normal,options.interval,'easeOutBounce') | |
.pump({normal: options.normal, | |
pump: options.pump, | |
interval: options.interval, | |
stop: options.stop}); | |
return $(this); | |
}); | |
} | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment