javascript - How to solve the js mouse wheel event problem
PHP中文网
PHP中文网 2017-05-19 10:09:15
0
1
417

When using jquery, the mouse wheelcan be triggered regardless of the height of the body(Please scroll the wheel under the result for the following address)
https://jsfiddle.net/shannon9/ 37fj5Lbs/embedded/

When using native js, when the height of the body is set (scroll bar appears), the mouse wheel event can be triggered:
https://jsfiddle.net/shannon9/05mfww8p/embedded/

Without setting a height for the body (that is, when no scroll bar appears), the mouse wheel event will not be triggered:
https://jsfiddle.net/shannon9/0ok2fd19/embedded /

How can I use native js to trigger the mouse wheel event like jquery when the height of the body is not set?

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
伊谢尔伦
//在控制台里输入
document.body.onmousewheel = function(){console.log(1);}
//然后滚动滚轮试试
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template