Hello,
first , thank you for this great online soft you’ve done here
I’m working on a tiny project, and I wanted to know how can we get the mouse wheel value.
Working with e.wheelDelta (the full code is below) seems to be ok in the editor, but when
we play the project , we cannot get the value of the mouse wheel …
Is there a trick or something to get this ? Thank you for your help !
Best .
var doScroll = function (e) {
// cross-browser wheel delta
e = window.event || e;
var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
// Do something with `delta`
current = current + delta;
console.log(current);
e.preventDefault();
};
if (window.addEventListener) {
window.addEventListener(“mousewheel”, doScroll, false);
window.addEventListener(“DOMMouseScroll”, doScroll, false);
} else {
window.attachEvent(“onmousewheel”, doScroll);
}