min30327 / luxy.js

Inertia scroll and parallax effect plugin in Vanilla.js
596 stars 86 forks source link

Turn off Luxy.js in Firefox #5

Open EmilyChews opened 5 years ago

EmilyChews commented 5 years ago

Hi,

Thanks for making such a wonderful resource.

Is there any way of turning Luxy off in Firefox? Firefox has is own native smooth scroll and luxy.js makes the native smooth scroll quite janky?

Many thanks

Emily

EmilyChews commented 5 years ago

Hi

I found a way around this:

var ff = !(window.mozInnerScreenX == null);
    if (!ff) {
        luxy.init({
            wrapperSpeed: 0.08
        });
    }
min30327 commented 5 years ago

Hi emilyChewsCheese,

I did not know FireFox did that. Thank you for sharing it.

The same case for Edge, and I avoid it as follows.

if(navigator.userAgent.match(/Trident\/7\./)) {
    document.body.addEventListener("mousewheel", function() {
        event.preventDefault();
        var wd = event.wheelDelta;
        var csp = window.pageYOffset;
        window.scrollTo(0, csp - wd);
    });
}