The jQuery Gestures project is a plugin that brings simple guesture support to the mouse.
In this demo, drag within the gray zone to create a gesture. You can use eight compass points, N, NE, E, SE, S, SW, W, NW.
The gesture must start and end within the "gesture" element - but you can apply this to the entire document as well as individual elements.
This version also supports composite gestures, which combine several compass directions to create a shape. This gives gestures many more variations than the eight compass points.
On the box below, try drawing a box shape, or just a simple line to see the plugin in action.
- Used to apply class names to the elements created by the plugin. You only need to specify a class modifier if you have a name-clash.
- The amount of movement to ignore (default 25)
- The event to start the gesture tracking (default "mousedown")
- The event to end the gesture tracking (default "mouseup")
- Whether to track advanced shapes (default false)
- The interval for advanced shape tracking (default 200)
- Whether to show a trail while tracking (default false)
- The interval for trail tracking (default 50)
- Time limit for each event (default 5000)
- A function to execute when an event fires, accepting argument of eventName (called on each event within an advanced shape)
- A function to execute when an advanced event fires, accepting argument of directions (array)