Skip to content

Instantly share code, notes, and snippets.

@shohagbhuiyan
Created August 3, 2017 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shohagbhuiyan/0981300fa6d96cf9ef82696ca6d3965a to your computer and use it in GitHub Desktop.
Save shohagbhuiyan/0981300fa6d96cf9ef82696ca6d3965a to your computer and use it in GitHub Desktop.
Add temporary class to HTML element
$(document).ready(function () {
$.fn.extend({
tmpClass: function (className, duration) {
var elements = this;
setTimeout(function () {
elements.removeClass(className);
}, duration);
return this.each(function () {
$(this).addClass(className);
});
}
});
// use of this function
$("#about h1").tmpClass("shake animated", 500);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment