min30327 / luxy.js

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

How to disable luxy? #3

Closed thibka closed 5 years ago

thibka commented 5 years ago

Hi, is there a way to disable luxy? I need to have the native scroll behavior on mobile. Thanks!

min30327 commented 5 years ago

Hi thibka. There is no function to disable luxy itself. I am applying control on mobile and tablet as follows.

var _ua = (function(u){
    return {
        Tablet:(u.indexOf("windows") != -1 && u.indexOf("touch") != -1 && u.indexOf("tablet pc") == -1) 
        || u.indexOf("ipad") != -1
        || (u.indexOf("android") != -1 && u.indexOf("mobile") == -1)
        || (u.indexOf("firefox") != -1 && u.indexOf("tablet") != -1)
        || u.indexOf("kindle") != -1
        || u.indexOf("silk") != -1
        || u.indexOf("playbook") != -1,
        Mobile:(u.indexOf("windows") != -1 && u.indexOf("phone") != -1)
        || u.indexOf("iphone") != -1
        || u.indexOf("ipod") != -1
        || (u.indexOf("android") != -1 && u.indexOf("mobile") != -1)
        || (u.indexOf("firefox") != -1 && u.indexOf("mobile") != -1)
        || u.indexOf("blackberry") != -1
    }
})(window.navigator.userAgent.toLowerCase());

var luxyEl = document.getElementById('luxy');
if(luxyEl){
    if(!_ua.Mobile&&!_ua.Tablet){
        Luxy.init();
    }
}
thibka commented 5 years ago

Alright, that should do it, thanks :)

min30327 commented 5 years ago

Thank you for using. Closed this issue, as solved the problem.