onHide() type event in jQuery

前端 未结 8 2172
旧巷少年郎
旧巷少年郎 2020-11-28 08:47

Does anyone know of an onHide() event or something similar in jQuery?

I tried:

$(this).bind(\'hide\', function(){
    console.log(\'asdasda\')
})         


        
8条回答
  •  有刺的猬
    2020-11-28 08:58

    There isn't a native or built in "hide" event but if you are using jQuery to hide it you can easily add a hide event:

    var _oldhide = $.fn.hide;
    $.fn.hide = function(speed, callback) {
        $(this).trigger('hide');
        return _oldhide.apply(this,arguments);
    }
    

提交回复
热议问题