title: track-pad tap event in javascript/jquery
body: <p>Is there any way to handle tap from track pad of mac?</p>
  
  <p>I need to handle 'tap' and 'click' on track-pad, especially on mac. </p>
  
  <p>I tried </p>
  
  <pre><code>$.event.special.tap = {
      setup: function(data, namespaces) {
          var $elem = $(this);
          $elem.bind('touchstart', $.event.special.tap.handler)
               .bind('touchmove', $.event.special.tap.handler)
               .bind('touchend', $.event.special.tap.handler);
      },
  
      teardown: function(namespaces) {
          var $elem = $(this);
          $elem.unbind('touchstart', $.event.special.tap.handler)
               .unbind('touchmove', $.event.special.tap.handler)
               .unbind('touchend', $.event.special.tap.handler);
      },
  
      handler: function(event) {
          event.preventDefault();
          var $elem = $(this);
          $elem.data(event.type, 1);
          if (event.type === 'touchend' &amp;&amp; !$elem.data('touchmove')) {
              event.type = 'tap';
              $.event.handle.apply(this, arguments);
          } else if ($elem.data('touchend')) {
              $elem.removeData('touchstart touchmove touchend');
          }
      }
  };
  
  $('.thumb img').bind('tap', function() {
      //bind tap event to an img tag with the class thumb
  }
  </code></pre>
  
  <p>Which didn't work. </p>
  
  <p>How to capture tap event on the track-pad?</p>