pinch in and out on elements on handheld devices.
Install with component(1):
$ component install component/pinch
pinch(img, function(e) {
dot.style.left = e.x + 'px';
dot.style.top = e.y + 'px';
dot.style['-webkit-transform'] = 'scale(' + e.scale + ')';
});
Initialize Pinch with the element el and callback function fn.
pinch(img, function(e) {
var midpoint = { x: e.x, y: e.y };
var scale = e.scale;
});
The event object e is augmented with following keys:
x: the x coordinate of the midpoint between your two fingersy: the y coordinate of the midpoint between your two fingersscale: the relative distance between your two fingers starting at 1.Unbind
e.rotate support for androidMIT