Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jQuery plugin - add temporary class name
$.fn.addTempClass = function(tempClass, duration){
if( !tempClass )
return this;
return this.each(function(){
var $elm = $(this);
$elm.addClass(tempClass);
setTimeout(function(){
$elm.removeClass(tempClass);
}, duration || 100);
});
}
@yairEO

This comment has been minimized.

Copy link
Owner Author

@yairEO yairEO commented Aug 25, 2014

Adds some class (or classes) to an element for a specific duration, then removes it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment