我是编程新手,正在寻找鼠标滚动操作,我的 onmouseup
命令可以工作,但找不到鼠标滚动操作。
当鼠标滚动停止滚动且并非所有滚动操作停止时,我需要getValue
。
如果有人能帮助我,这将是一个很大的帮助。这是我正在使用的代码。
<div tabindex="0" id="mup" class="my results"
style="width:649px;height:649px;"
onmouseup="javascript:getValue('','')"
mousescroll="javascript:getValue('','')">
最佳答案
您需要监听 onmousewheel
和 onwheel
事件:
<div id="scroll" onwheel="onWheel();" onmousewheel="onWheel();">
然后你需要一个计时器来检查滚动何时完成:
var theTimeout;
function onWheel(){
clearTimeout(theTimeout);
theTimeout=setTimeout(function(){
doSomething();
},500);
};
查看此JSFiddle example .
关于javascript - 鼠标滚轮停止滚动时获取Value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20205466/