joelkrause
8/28/2019 - 1:30 AM

used to reverse scrolling to scroll horizontal instead of vertically

used to reverse scrolling to scroll horizontal instead of vertically

document.addEventListener('wheel', function (e) {
    if (e.type != 'wheel') {
        return;
    }
    let delta = ((e.deltaY || -e.wheelDelta || e.detail) >> 10) || 1;
    delta = delta * 25;
    document.documentElement.scrollLeft -= delta;
    // safari needs also this
    document.body.scrollLeft -= delta;
    e.preventDefault();
}, {
    passive: false
});