Created
August 3, 2017 00:50
-
-
Save shohagbhuiyan/0981300fa6d96cf9ef82696ca6d3965a to your computer and use it in GitHub Desktop.
Add temporary class to HTML element
This file contains hidden or 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
$(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