You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The vast majority of mobile devices used today support this, and those who want to support other devices could detect if the browser supports it if needed.
The text was updated successfully, but these errors were encountered:
I modified the plugin to resolve the following issues:
prevent spurious swipe events when double-tap is detected. This prevent spurious swipe events when people use the one-finger "double-tap + drag" zoom feature on Firefox.
prevent spurious swipe events when multi-finger gestures are detected. This prevents spurious swipe events when people do zoom-in / zoom-out gestures that could otherwise trigger spurious swipe events.
prevent spurious swipe when people scroll the window by a motion that is not completely vertical (or horizontal for horizontally scrolling window), useful for Chrome.
added an optional trace/log function (quite useful for remote debugging)
added config flags to support passive handler, returned value etc.
fixed a bug: swipeleft/swiperight should occur if abs(dx) >= threshold AND abs(dx) > abs(dy) -- the second part of the condition was missing from the code, sometimes causing swipeleft/swiperight in case where swipeup/swipedown should have occurred.
All this have been tested on Chrome, Firefox, Opera and Safari mobile browsers.
I still have a problem: On Firefox mobile (android), touch events are not sent to the handler if "some" scrolling happens when you swipe, even if you swipe mostly right/left. No such problem with Chrome (on Chrome, events are always sent to the handler, whether they cause a scroll or not - we just need to prevent spurious events when a scroll occurred, which we have implemented).
For FF. It is possible to disable default handling, but in that case scrolling does not happen at all, which is an issue in sites that require vertical scroll support and swipe right/left at the same time (like my site). It may be possible to disable default handling and still send the events for the default handling AFTER they have been processed by the plugin. I have not yet managed to do that... Maybe something like what is described there: https://stackoverflow.com/questions/7610871/how-to-trigger-an-event-after-using-event-preventdefault
I can provide you my code, if you are interested to update your plugin. I feel it is significant improvement for usability, especially with the prevention of spurious events in case of double tab, multi-finger gesture, and gesture causing scroll (on Chrome).
It is the one I currently on my photo website with swiping photos in an album. let me know of the best way to provide the updated code.
Google recommends using what they call "passive listeners" for touch handlers on mobile devices, to improve scrolling performance.
https://developer.chrome.com/en/docs/lighthouse/best-practices/uses-passive-event-listeners/
So I think the plugin code should be changed to use this:
document.addEventListener('touchstart', onTouchStart, {passive: true});
etc...
The vast majority of mobile devices used today support this, and those who want to support other devices could detect if the browser supports it if needed.
The text was updated successfully, but these errors were encountered: