Skip to content

Instantly share code, notes, and snippets.

@arkadylukashov
Created November 6, 2012 08:55
Show Gist options
  • Save arkadylukashov/4023570 to your computer and use it in GitHub Desktop.
Save arkadylukashov/4023570 to your computer and use it in GitHub Desktop.
Fade Toggler
$.fn.fadeToggle = function(speed, callback, important) {
return this.each(function() {
$(this)[ important ? ( important == 'show' ? 'fadeIn' : 'fadeOut') : ( $(this).is(':visible') ? 'fadeOut' : 'fadeIn' ) ](speed, callback);
});
}
$.fn.fadeToggle = function(s,c,i){return this.each(function(){$(this)[i?(i=='show'?'fadeIn':'fadeOut'):($(this).is(':visible')?'fadeOut':'fadeIn')](s,c);});}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment