0

I created a site that will change images from being displayed on mouse scroll. It was working until this morning on my local machine, but suddenly stopped. When I check the dev console I get an error message that says "[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/6662647093133312"

I have read the information at the provided url and I still do not understand how I can turn off this feature. In my code I have the following:

var changeImage = function changeImage(event) {
    event.preventDefault();
    if (brochure.waitForDelay === false) {
        window.onwheel = function () {
            return false;
        };
        brochure.waitForDelay = true;
        if (event.deltaY < 0) {
            scrollUp();
        } else {
            scrollDown();
        }
        setTimeout(function () {
            brochure.waitForDelay = false;
            window.onwheel = function () {
                return true;
            };
        }, 1250);
    } else {
        return;
    }
};
var determineScrollDirection = function determineScrollDirection() {
    document.addEventListener('wheel', changeImage, { passive: false });
};

In determineScrollDirection I set the passive as false and tried to call preventDefault in the changeImage function but I still get the same error message.

1 Answers1

0

I was able to fix this issue by removing the following line:

 window.onwheel = function () {
        return false;
    };