2017 © Pedro PelĆ”ez
 

component jquery-ui-touch-punch

Extension to jQuery UI for mobile touch event support

image

petersheppard/jquery-ui-touch-punch

Extension to jQuery UI for mobile touch event support

  • Tuesday, January 2, 2018
  • by petersheppard
  • Repository
  • 0 Watchers
  • 0 Stars
  • 6 Installations
  • 0 Dependents
  • 0 Suggesters
  • 1023 Forks
  • 0 Open issues
  • 1 Versions
  • 20 % Grown

The README.md

jQuery UI Touch Punch

Touch Event Support for jQuery UI

jQuery UI Touch Punch is a small hack that enables the use of touch events on sites using the jQuery UI user interface library., (*1)

Visit the official Touch Punch website., (*2)

Currently, jQuery UI user interface library does not support the use of touch events in their widgets and interactions. This means that the slick UI you designed and tested in your desktop browser will fail on most, if not all, touch-enabled mobile devices, because jQuery UI listens to mouse eventsā€”mouseover, mousemove and mouseoutā€”not touch eventsā€”touchstart, touchmove and touchend., (*3)

That's where jQuery UI Touch Punch comes in. Touch Punch works by using simulated events to map touch events to their mouse event analogs. Simply include the script on your page and your touch events will be turned into their corresponding mouse events to which jQuery UI will respond as expected., (*4)

As I said, Touch Punch is a hack. It duck punches some of jQuery UI's core functionality to handle the mapping of touch events. Touch Punch works with all basic implementations of jQuery UI's interactions and widgets. However, you may find more complex cases where Touch Punch fails. If so, scroll down to learn how you can file and/or fix issues., (*5)

This code is dual licensed under the MIT or GPL Version 2 licenses and is therefore free to use, modify and/or distribute, but if you include Touch Punch in other software packages or plugins, please include an attribution to the original software and a link to this Touch Punch website., (*6)

Using Touch Punch is as easy as 1, 2ā€¦

Just follow these simple steps to enable touch events in your jQuery UI app:, (*7)

  1. Include jQuery and jQuery UI on your page., (*8)

    <script src="http://code.jquery.com/jquery.min.js"></script>
    <script src="http://code.jquery.com/ui/1.8.17/jquery-ui.min.js"></script>
    
  2. Include Touch Punch after jQuery UI and before its first use., (*9)

    Please note that if you are using jQuery UI's components, Touch Punch must be included after jquery.ui.mouse.js, as Touch Punch modifies its behavior., (*10)

    <script src="jquery.ui.touch-punch.min.js"></script>
    
  3. There is no 3. Just use jQuery UI as expected and watch it work at the touch of a finger., (*11)

    <script>$('#widget').draggable();</script>
    

Tested on iPad, iPhone, Android and other touch-enabled mobile devices., (*12)

The Versions

02/01 2018

dev-master

9999999-dev http://touchpunch.furf.com/

Extension to jQuery UI for mobile touch event support

  Sources   Download

MIT

by Dave Furfero

mobile touch gestures