Javascript (jquery) - Multiple Handlers attached to one event: How to detach only one?

前端 未结 3 1228
野的像风
野的像风 2021-01-13 10:07

In this module I\'m working on I have a listener to a \'resize\' event in the window. Every time the module is ran, I need to check if there\'s already a listener registere

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-13 10:53

    Do something like this-

    $(window).off('resize.myCustomEvent'); 
    

    and vice versa to attach it

提交回复
热议问题