GitHub

Summary

Use this unified event plugin to applications that easily and seamlessly support mobile (touch) and desktop (mouse) environments.

The plugin recognizes mouse, keyboard, and touch motions that have the same intent and publishes unified events for them. For example, a long-press intent is expressed with a mouse by pressing-and-holding on the left mouse button for over half a second without substantially moving the mouse. The same intent on a touch device is expressed by placing a finger on the screen for over half a second without substantially moving the finger. This pugin recognizes both motions as having the same intent and publishes a single uheld event for either.

Here are the full list of intents supported by this unified event plugin:

  • utap - Mouse-click (mouse) / Finger tap (touch)
  • uheld - Long-mouse-press / Finger-press-and-hold
  • udrag - Mouse-click-and-drag / Finger Swipe
  • uhelddrag - Long-mouse-press-and-drag / Finger-press-and-hold-and-drag
  • zoom - Mouse-click-and-drag-Y + shift / Finger-pinch

This plugin is used in multiple commercial SPAs and is featured in the best-selling book Single Page Web Applications - JavaScript end-to-end, also available on Amazon.

Please see the ue-test.html file for a demonstration of the different intents. Expected behavior is expressed in the BR corner of the tiles. If you see any unexpected behavior while testing motions on your device please file a bug report so we can fix it!

Browser Support

This plugin works with jQuery 1.7.0+, and has been tested on most jQuery versions through 3.0.0. It works with the latest versions of popular browsers: Chrome 15+, Firefox 23+, Safari 5+, and IE 9+. IE9 requires edge settings:

"

Read the original on github.com ↗