Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
pinch in and out on elements on handheld devices
JavaScript HTML Makefile
branch: master
Failed to load latest commit information.
.gitignore Initial commit
History.md Release 0.0.7
Makefile Initial commit
Readme.md make event object mutable
component.json Release 0.0.6
e.js fix comment
index.js fix require of component/events
package.json fix name
test.html better images for example

Readme.md

pinch

pinch in and out on elements on handheld devices.

Installation

Install with component(1):

$ component install component/pinch

Example

pinch(img, function(e) {
  dot.style.left = e.x + 'px';
  dot.style.top = e.y + 'px';
  dot.style['-webkit-transform'] = 'scale(' + e.scale + ')';
});

API

Pinch(el, fn)

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 fingers
  • y: the y coordinate of the midpoint between your two fingers
  • scale: the relative distance between your two fingers starting at 1.

Pinch.unbind()

Unbind

TODO

  • add e.rotate support for android

License

MIT

Something went wrong with that request. Please try again.