0

I need to capture the double tap event on a jqplot chart.I went throught the below link. http://appcropolis.com/implementing-doubletap-on-iphones-and-ipads/ In jquery.jqplot.js, I inserted the following code :

this.onTouchEnd = function(ev) {

   var now = new Date().getTime();
   var lastTouch = $(this).data('lastTouch') || now + 1 /** the first time this will make delta a negative number */;
   var delta = now - lastTouch;
   clearTimeout(action);
   if(delta<500 && delta>0){
           // the second touchend event happened within half a second. Here is where we invoke the double tap code
           alert("Doubletapped");
   }else{
           // A click/touch action could be invoked here but wee need to wait half a second before doing so.
           alert("notdoubletapped");
   }
   $(this).data('lastTouch', now); 

But it doesnt detect the double tap event. In the case of jqplot, what should 'this' refer to? Should it refer to ev.data.plot? $(this).data('lastTouch')

user930514
  • 917
  • 2
  • 16
  • 28
  • Have you looked at the jQuery `.dblclick` event binder: http://api.jquery.com/dblclick/ – Calavoow Oct 29 '12 at 09:15
  • @Calavoow : But i need to capture doubletap on iPad and not doubleclick which works for the browser – user930514 Oct 29 '12 at 09:18
  • Related question: http://stackoverflow.com/questions/5507638/whats-the-best-way-to-handle-longtap-and-double-tap-events-on-mobile-devices-us – Calavoow Oct 29 '12 at 09:51

0 Answers0