[jQuery] $.slideToggle() toggles the slide effect

[jQuery] $.slideToggle() toggles the slide effect

Hi,
I'd like to propose the following function for jQuery:
/**
 * This function slides the matched elements either down (showing them) or up
 * (hiding them) depending on their previous state.
 *   $("p").slideToggle("fast");
 */
jQuery.prototype.slideToggle = function(speed, callback) {
    return this.animate({height: this.css("display") == "none" ? "show" : "hide"}, speed, callback);
};
Konstantin
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/