Is It Possible To Have Gestures With Trackpads?
On a Macbook Pro in Chrome, sliding two fingers across the screen allows you to move backwards and forwards. How do I go about disabling this, and creating custom gestures in jQuer
Solution 1:
Update May 2017
- Chrome has implemented the new wheel-event. Pinch-Zoom can be detected as a wheel-event with
ctrlKey === true
. - Firefox is going to ship the same behaviour in Fx55.
- Edge supports the wheel-event unless you are using a "precision-touchpad". No Idea what about pinch-zoom.
- opera probably matches chrome-behaviour (not tested)
- safari has basic wheel-events and supports the proprietary (yet kinda great) gestureEvents
Original Answer
As of April 2016, the pinch-zoom gesture is supported in (very) different ways in different browsers:
- Chrome sends
mousewheel
-events withev.ctrlKey===true
- Mozilla is discussing matching chrome-behaviour: https://bugzilla.mozilla.org/show_bug.cgi?id=1052253
- In modern Safari (>9.1) gesture-events can be used: https://developer.apple.com/library/archive/releasenotes/General/WhatsNewInSafari/Articles/Safari_9_1.html and https://developer.apple.com/documentation/webkitjs/gestureevent
- Edge is unlikely to handle it at all.
Solution 2:
Touchpads do not trigger touch-related events (but usually control the mouse pointer instead. This cannot be affected by a website for obvious reasons) so that's not possible.
If gestures done on a touchpad have non-standard behaviour this is usually done by the touchpad's driver/software.
Post a Comment for "Is It Possible To Have Gestures With Trackpads?"