I\'m trying to get a piece of our JavaScript run after some 3rd party code makes a modal dialog appear. I saw a pretty neat idea of hijacking the jQuery show function, but unfor
I found another solution to this over here, with a slight tweak of my own.
(function($){
$.each(['show','hide'],function(i,ev){
var el = $.fn[ev];
$.fn[ev] = function(){
this.trigger(ev);
return el.apply(this,arguments);
};
});
})(jQuery);
It doesn't offer the before/after events of other examples but it could certainly be elaborated on. It's working for me so far and hope it continues to do so--it's a nice little approach that can easily be expanded to other jQuery functions, including the various alternatives to show.
** Note this also fires an event for "hide".