I'm trying to use this jQuery plugin to enable horizontal scrolling using the mouse wheel. I followed this short CSS-Tricks tutorial exactly. However, I'm getting this error when scrolling on the page:
[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.
Here's the exact code used in my main.js:
$(function() {
$("body").mousewheel(function(event, delta) {
this.scrollLeft -= (delta * 30);
event.preventDefault();
});
});
I just tested replacing $("body")
with an exact div $("#mainContainer")
and it works. I'm just wondering why it won't work with the body as it does in the tutorial?