2017-02-15 82 views
0

我使用mousewheel.js jQuery插件 https://github.com/jquery/jquery-mousewheel使用mousewheel.js,如何暫時禁用'mousewheel'事件?

我該如何暫時禁用「鼠標滾輪」事件?

或者如何解除綁定並在一段時間後綁定它?

$(window).on('mousewheel', function(event) { 

}); 

謝謝!

+0

這裏非常類似的問題:http://stackoverflow.com/questions/6702116/jquery-mousewheel-how-to-disable – DeclanPossnett

+0

'$(window).off('mousewheel')'? [斷開jQuery中的事件](https://learn.jquery.com/events/handling-events/#disconnecting-events) – barbsan

+0

這裏是小提琴:https://jsfiddle.net/bfdyxobn/11/ 我可能會做一些愚蠢的,但在點擊事件使用.off()後,它仍然觸發 謝謝! –

回答

0

要綁定:

$(window).bind("mousewheel", function(e){ return false;}); 

解除綁定:

$(window).unbind("mousewheel", function(e){ return false;});