Skip to content

Instantly share code, notes, and snippets.

@elieandraos
Last active December 4, 2016 15:56
Show Gist options
  • Save elieandraos/5849270 to your computer and use it in GitHub Desktop.
Save elieandraos/5849270 to your computer and use it in GitHub Desktop.
Creating a prototype function on a dom element
$.fn.customFadeIn = function(fn) {
//set opacity to 0 and visibility to visibile
$(this).css({"opacity" : 0, "visibility" : "visible" });
$(this).animate({opacity: 1}, 1000, "swing", function(){
if(typeof fn == 'function')
fn.call(this);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment