Skip to content

Instantly share code, notes, and snippets.

@fumikito
Created September 13, 2010 05:52
Show Gist options
  • Save fumikito/576860 to your computer and use it in GitHub Desktop.
Save fumikito/576860 to your computer and use it in GitHub Desktop.
Extend MooTools' fade in & out.
/**
* Code snipet for fade in & out with MooTools.
* @author Takahashi Fumiki
* @description
*/
Element.prototype.fadeIn = function(display){
if(display == undefined)
display = "block";
var fx = new Fx.Morph(this);
this.setStyles({
visibility: "visible",
display: display,
opacity: 0
});
this.fade("in");
};
Element.prototype.fadeOut = function(){
var fx = new Fx.Morph(this);
fx.start({
opacity: [1,0]
}).chain(function(){
this.start({
display: "none"
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment