Good day. Here on this site RBC.ru there is a functionality that changes the pages of news when scrolling a mouse. How to do it? Is there an example or implementation?
1 answer
It depends on how to implement a page change, load a new one or change an address. And behind everything stands the event wheelDeltaY or deltaY . According to these events, you can realize your plans.
window.onmousewheel = function(e) { document.querySelector('#mouseevent').innerHTML = e.wheelDeltaY > 0 ? '↑ вверх' : '↓ вниз'; } <span id='mouseevent'></span> deltaY contains the value of the set number of mouse scroll lines.
One line is equal to 33.3, and 3 lines, respectively, 100.
|
