GianlucaGuarini / Tocca.js

Super lightweight script (~1kb) to detect via Javascript events like 'tap' 'dbltap' 'swipeup' 'swipedown' 'swipeleft' 'swiperight' on any kind of device.
http://gianlucaguarini.github.io/Tocca.js/
MIT License
660 stars 60 forks source link

swipe won't work crome 62.0.3202 android 5.1.1 SM-J320F build/LMY47V #54

Closed englishextra closed 6 years ago

englishextra commented 6 years ago

But it works - Tocca.js 2.0.1 - on same android with firefox 57.0

But demo here detects events with Chrome 62.0.3202 fine

So yes some pages on my sites have:

html,
body {
    height: 100%;
}
body {
    width: 100%;
    overflow-x: hidden;

or

html,
body {
    height: 100%;
}
body {
    width: 100%;
    overflow-y: auto;

That's all that I had dug out.

testing page here https://englishextra.github.io/ - swipeup or swipedown

Important : the events are set to passive.

var mousewheeldown = document[getElementsByClassName]("mousewheeldown")[0] || "";
var swipeup = document[getElementsByClassName]("swipeup")[0] || "";
if (mousewheeldown && swipeup) {
    if (hasTouch) {
        mousewheeldown[style].display = "none";
        if (root.tocca) {
            root[_addEventListener]("swipeup", revealStart, {passive: true});
            root[_addEventListener]("swipedown", concealStart, {passive: true});
        }
    } else {
        if (hasWheel) {
            swipeup[style].display = "none";
            if (root.WheelIndicator) {
                var indicator;
                indicator = new WheelIndicator({
                        elem: root,
                        callback: function (e) {
                            if ("down" === e.direction) {
                                revealStart();
                            }
                            if ("up" === e.direction) {
                                concealStart();
                            }
                        },
                        preventMouse: false
                    });
            }
        }
    }
    if (hasTouch || hasWheel) {
        guesture[classList].add(bounceInUpClass);
        guesture[style].display = "block";
    }
}

caniuse says android chrome 62 and webview 62 support passive listeners

Tocca.js 2.0.1 swipeup and swipedown works in chrome 49.2623.91 on android 6.0.1; P024 build/MMB29M

Doesnt work on my site with Opera 43.02246

GianlucaGuarini commented 6 years ago

fixed in v2.0.2

englishextra commented 6 years ago

why would you close the issue. can you give me a day or two to test that fix?

GianlucaGuarini commented 6 years ago

sorry i guess i will need to reopen it. I am still unhappy with the current result.

englishextra commented 6 years ago

@GianlucaGuarini First thing in the morning I can test that. Sorry but your lib is an imortant part in the logic of my apps - so any changes are sensitive.

GianlucaGuarini commented 6 years ago

ok now it should be fine. Please check your issue and close it if it was fixed

englishextra commented 6 years ago

It works fine, very nice and thanks.