Pinchable
Wrap any HTML element to make it pinch-zoomable and pannable on mobile — no dependencies.
Key features
- Natural pinch-zoom — the point between your fingers stays anchored.
- Drop-in wrapper for any element.
-
Configurable
maxZoom
, pinchvelocity
(sensitivity), and transitionapplyTime
. - Smart edges — content clamps to bounds; tiny reverse motions near edges don’t jitter.
- Max-zoom hysteresis — small reverse motions after hitting the limit won’t snap out.
-
Programmatic
focus()
to smoothly zoom to a target point using normalized [0..1] coordinates; temporarily disables manual gestures while applying. - Enable/disable gestures on the fly; clean teardown.
Behavior tips
- Hit max zoom, then separate your fingers a lot and start bringing them closer — zoom-out will kick in smoothly after a small threshold, not instantly.
- Pan to an edge until movement stops, move a bit farther in the same direction, then reverse — the element starts moving back almost immediately (no sticky edge feel).
2.5
1
0.7
400
0.2
10