2017-02-15 70 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;});