These properties may surprise you:
The touch-action CSS property is a powerful tool for controlling user interactions with an element, helping to prevent unnecessary event dispatching.
While you can't introduce new touch interactions, you can limit existing ones as needed. So how does the pinch-zoom
property come into play?
Panning on a website typically triggers zooming in on the page content. Specifying a touch-action can override this behavior, but incorporating pinch-zoom will allow it again.
Implementing a pinch-zoom solution via CSS alone is not common knowledge. However, with some JavaScript and key touch events (touchstart
, touchmove
, touchend
), it's achievable. Additionally, libraries like hammerjs offer handy gesture functionalities.
To delve deeper into touch-action functionality, check out this resource here.