Skip to content

Instantly share code, notes, and snippets.

@Oshuma
Created May 7, 2009 00:54
Show Gist options
  • Select an option

  • Save Oshuma/107852 to your computer and use it in GitHub Desktop.

Select an option

Save Oshuma/107852 to your computer and use it in GitHub Desktop.
Simple jQuery effect toggles.
// Simple jQuery effect toggles.
// Use just like the jQuery.toggle() method.
//
// $('#some-link').click(function() {
// $('#some-div').slideToggle();
// });
jQuery.fn.fadeToggle = function() {
if (this.css('display') == 'none') this.fadeIn();
else this.fadeOut();
}
jQuery.fn.slideToggle = function() {
if (this.css('display') == 'none') this.slideDown();
else this.slideUp();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment