For example, the content size is
width: 100vw;
height —100vh;
Would it be possible to determine the top and bottom of the scroll and the left and right sides of the swipe when (not scrolling)?
I only checked with Firefox, but I think I can get the scroll through the wheel
event (WheelEvent).
deltaMode
indicates whether the scroll is in pixels (0), lines (1), and pages (2), but if you want to know the amount of scroll swipe you have, you can ignore it.
dsip= document.getElementById('disp');
let x = 0, y = 0, z = 0;
document.addEventListener('wheel',(e)=>{
x+=e.deltaX;
y + = e.deltaY;
z+=e.deltaZ;
disp.innerHTML =
'x:'+e.deltaX+'<br>'+
'y:'+e.deltaY+'<br>'+
'z:'+e.deltaZ+'<br>'+
'Total' + '<br>' +
'x:'+x+'<br>'+
'y:'+y+'<br>'+
'z:'+z+'<br>'+
'scroll mode:' + e.deltaMode;
}, false);
body{
height —1vw;
width —1vw;
overflow — hidden;
}
#disp{
position:absolute;
top —30px;
left: 30px;
}
1<br>1>1>1>1>1>1>1>1>1>1>1>br>1>1>1>1>1>1>1>1>1>1>1>1>1>1>1;1>1;1;1;1;1;1;1;1;1;1;1;1;
<divid=disp>disp</div>
© 2024 OneMinuteCode. All rights reserved.