title: Using touch event + jquery-ui sortable on mobile not working as expected
body: <p><strong>Context:</strong></p>
  
  <p>I'm making a web application for mobile devices. I'm using <em>jquery-ui sortable</em> for sort a items list where the first and last items are not sortable.</p>
  
  <p><strong>The Goal:</strong></p>
  
  <p>My goal is use the <em>jquery-mobile</em> tap-hold event to enable the <em>jquery-ui sortable</em> library so the user can sort the item that he tapped. When the user put the item in the right place, I want to disable the <em>jquery-ui sortable</em> again.</p>
  
  <p><strong>The Problem:</strong></p>
  
  <p>In terms of usability, what I want is that the user tap the screen, stay holding for x seconds and without stop holding , could start sort the item. This is not happening. What it is happening is you need to stop holding for the <em>jquery-ui sortable</em> catch the event and allow the user to sort the item that he wants.</p>
  
  <p><strong>The Code:</strong></p>
  
  <p>Follows the core of the code that I'm using. You don't need a mobile device to reproduce the error.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I detect that I need the <em>touch-puch</em> javascript library to simulate touch events for <em>jquery-ui</em> work. Basically the library converts touch events to mouse events. But the original problem was not solved.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function initializeSortablePages() {
   var sortableParentDiv = $(".sortable");
   var sortableDivs = $(".sortable .to-move");
   
   $(sortableParentDiv).sortable({
    items: sortableDivs,
    stop: function (event, ui) {
     disableSortablePages(sortableParentDiv);
    }
   });
    
   addTapHoldEventToSortablePages(sortableParentDiv, sortableDivs)
   disableSortablePages(sortableParentDiv);
   
  }
  
  function addTapHoldEventToSortablePages(sortableParentDiv, sortableDivs) {
   var thisLib = this;
   $(sortableDivs).bind('taphold', function (event, ui) {
    enableSortablePages(sortableParentDiv);  
   });
  }
  
  function enableSortablePages(sortableParentDiv) {
   $(sortableParentDiv).sortable("enable");
  }
  
  function disableSortablePages(sortableParentDiv) {
   $(sortableParentDiv).sortable("disable");
  }
  
  initializeSortablePages();</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.sortable div{
   width: 100px;
   height: 30px;
   background-color: white;
   margin-top: 20px;
   padding-top: 15px;
   background-color: #d4d4d4;
   padding-left:10px;
   cursor: move;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html lang="en"&gt;
  &lt;head&gt;
   &lt;meta charset="utf-8"&gt;
   &lt;title&gt;sortable demo&lt;/title&gt;
   &lt;link rel="stylesheet" href="style.css"&gt;
   &lt;script src="//code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt;
   &lt;script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
   &lt;script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"&gt;&lt;/script&gt;
    &lt;script src="https://cdn.jsdelivr.net/jquery.ui.touch-punch/0.2.3/jquery.ui.touch-punch.min.js"&gt;&lt;/script&gt;
    
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div class="sortable"&gt;
     &lt;div&gt;Item 1&lt;/div&gt;
     &lt;div class="to-move"&gt;Item 2&lt;/div&gt;
     &lt;div class="to-move"&gt;Item 3&lt;/div&gt;
     &lt;div class="to-move"&gt;Item 4&lt;/div&gt;
     &lt;div&gt;Item 5&lt;/div&gt;
   &lt;/div&gt;
   &lt;script src="javascript.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>