使用jQuery检查没有滚动条的mousewheel事件 [英] Use jQuery to check mousewheel event without scrollbar
本文介绍了使用jQuery检查没有滚动条的mousewheel事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在没有滚动条的情况下检查鼠标滚轮的运动?
How to check mousewheel movement without scrollbar?
$(document).mousewheel(function() {
clicker.html("a7a");
});
推荐答案
我强烈建议您使用以下jQuery插件:插件 a>
I highly recommend you use this jQuery plugin: PLUGIN
没有插件,请尝试以下示例:示例
Without a plugin, try this example: EXAMPLE
HTML:
<div id='foo' style='height:300px; width:300px; background-color:red'></div>
Javascript:
$('#foo').bind('mousewheel', function(e) {
if(e.originalEvent.wheelDelta / 120 > 0) {
alert('up');
} else {
alert('down');
}
});
div上没有滚动条,但检测到wheel事件.
There is no scrollbar on the div but the wheel event is detected.
这篇关于使用jQuery检查没有滚动条的mousewheel事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文