Is it possible to detect when jQuery has fired it's .hide()
method on an element?
I tried binding to the hide
event on such an element:
$('div').bind('hide', function(){
alert("Hidden");
})
but the alert doesn't display.
You can do it by overriding JQuery's hide method:
var oldHide = $.fn.hide;
$.fn.hide = function() {
alert("Hidden");
oldHide.apply(this, arguments);
}
...as shown here.
all the time? or just for debugging?
you could just use the call back function to write something to the log.
$( '#my-id' ).hide( duration, function(){ console.log( 'fired!' ); } );
精彩评论