Patch jQuery fadeTo() to Bring Back the Dead
- published:
- 2009.05.14
- topics:
- javascript
Well, maybe not bringing back the dead exactly, but I did patch the jQuery function fadeTo() to bring back elements after hide() or fadeOut() were called on them.
Just paste this in your JavaScript after you load jQuery:
/**
* Fix jQuery fadeTo() so it can bring back something after hide() or fadeOut()
*/
(function ($) {
var proxied = $.fn.fadeTo;
$.fn.fadeTo = function() {
if ($(this).is(':hidden')) {
$(this).css('opacity', 0).show();
}
return proxied.apply(this, arguments);
}
})(jQuery);
I'd like to just see them fix this in the library itself, so I submitted a ticket.