亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Please give me some advice on how to monitor the mouse wheel event in js and then jump out of the currently running method.
天空翱翔
天空翱翔 2021-10-28 09:20:05
0
4
1146

Dear bosses:

I have a piece of js code that uses jquery’s animate method. I need to

monitor the movement of the mouse wheel when this code is running. If there is The movement of the mouse wheel will exit this animate method. Please tell me how to write the code?

Attachment:

window.onload = function () { setTimeout(autorollup,3000); function autorollup(){ $("#part2").animate( {top: "-=800px"}, 8000); }

Thank you for your enlightenment!

天空翱翔
天空翱翔

reply all(2)
雪了無(wú)痕

http://xf0c11m.cn/ Paipai.com View online

逆旅行人

Just add event listening, window.addEventListener("wheel", callback function);

  • reply Thanks! I mainly don't know how to add it to the code? How to write the callback function? Beginners can't write.
    天空翱翔 author 2021-10-28 17:12:59
  • reply var StopscrollFunc=function(e){ e=e || window.event; if (e.wheelDelta || e.detail) {//Firefox //Custom event: write specific implementation logic $("#part2").stop(true); } } document.addEventListener('DOMMouseScroll',StopscrollFunc,false); If I write like this, the effect of mouse scrolling will be prevented indefinitely, because it is always listening. I need this monitoring to stop scrolling to run only once. How should I write the code? Thanks!
    天空翱翔 author 2021-10-28 17:17:55
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template