title: Cancel touchend if touchmove fires
body: <p>I'm building something mainly for use on tablets, where the user can tap an item on the screen and a class is applied to it. This is what I have so far:</p>
  
  <p>The problems:</p>
  
  <ol>
  <li>I want to use touch events to remove the class and add the class on touch end (to make it faster).</li>
  <li>I don't want it to do anything if the user swipes (touchmoves).</li>
  </ol>
  
  <p>I've tried a number of things, none of which have worked. The simplest I've tried (unsuccessfully) is this:</p>
  
  <pre><code>var dragging = false;
  
  $(".items").on("touchmove", function(){
        dragging = true;
  });
  
  $('.items').on("click touchend", function(event){
      if (dragging = true){
      }
      else{
      $('.items').removeClass('selected');
      $(this).addClass('selected');
      }
  });
  </code></pre>