javascriptjquerytrackpad

Detect MacBook trackpad two-finger tap with JavaScript/jQuery


I wonder if there's any way to detect if the user made a two-finger tap on the MacBook trackpad with JavaScript or jQuery. In one of the projects I'm detecting right mouse click with JavaScript and using it for some actions. It actually doesn't work when you make a double finger tap on a trackpad. While in action that works as a right click, but JavaScript can't detect it like so.

Any clues?


Solution

  • You can use the mouse events button property - MDN reference

    Demo jsFiddle