I am working on a force directed graph using d3.js. I need to handle tap and double tap event on nodes for mobile devices. Mouseover and click functions need to replicated as tap and double tap in d3.js. I have managed to get a touch event working but have no clue on how to capture double tap event in a mobile device.
Asked
Active
Viewed 7,387 times
13
-
1i think you should check this post http://stackoverflow.com/questions/5507638/whats-the-best-way-to-handle-longtap-and-double-tap-events-on-mobile-devices-us – rahul Aug 10 '12 at 05:05
2 Answers
5
D3 has the touches event and using this you can get touch position coordinates from inside your event handler, but this doesn't give you any special handling for or help identify long press and doubletap. You can add support for long press and double tap yourself. For long press, have a look at this example:
If you're using jQuery, there are doubletap plugins like this one:

Community
- 1
- 1

Mark Roper
- 1,389
- 1
- 16
- 27
0
Unfortunately, there is no double tap in d3, so as suggested before, you got to work with touchstart. Here is how

dehumanizer
- 1,250
- 12
- 15