Access Touch and Mouse Events in a standard way
JavaScript CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Interact is essentially a wrapper on top of touch and mouse events. It exists to make the process of writing apps / demos that handle touch events both simpler to write and also allow them to support mouse events easily.

Events are distributed using eve.

Interact is distributed under an MIT License

NOTE: Breaking Changes

For the purposes of more terse event names, the following events have been renamed:

  • interact.pointer.down => interact.down
  • interact.pointer.move => interact.move
  • interact.pointer.up => interact.up

Example Usage

Handling simple down, move, and up events is easy:

eve.on('interact.down', function(evt, absXY, relXY) {
	console.log('pointer down @ ', absXY);

// handle pointer move events
eve.on('interact.move', function(evt, absXY, relXY) {
	console.log('pointer move @ ', absXY);

// handle pointer up events
eve.on('interact.up', function(evt, absXY, relXY) {
	console.log('pointer up @ ', absXY);

// watch the specified target'targetElementId');

Through the way eve behaves, the above event handlers would relay events captured for any watched elemnet. If you want to limit the event capture to a specific event then use the following syntax:

eve.on('interact.pointer.down.targetElementId', function(evt, absXY, relXY) {
	console.log('pointer down @ ', absXY);

Accessing the Original DOM events

The original DOM event that was captured is available in the first argument of all interact fired events. In the case of derived events such as interact.tap, interact.pan and interact.zoom the DOM event maps back to the last event that was captured that triggered the condition. For instance, in the case of a tap, the last event that would be processed would be an *up event so that is what is communicated back.

Pan and Zoom Helpers

To be completed

Multi Touch Event Handlers

To be completed.