How can I catch tap on a touch phone?

Hi. Made a mobile menu to close when clicking outside it and outside its children.

$(document).on('click', function (e) {
var container2 = $(".mobile-menu");
if (container2.has( === 0){

On the desktop everything is cool works as it should, but no mouseup, tried to attribute to "tap" instead of "mouseup", but something isn't working.

"click" use is not an option in my case. Who-thread prompt as you write the code with the event "tap" or something? If the type was tap out diva, you to menu add class 'menu-closed'???
June 10th 19 at 15:07
1 answer
June 10th 19 at 15:09
<canvas id="canvas" width="600" height="600" style="border:1px solid black;">
 Your browser does not support the canvas element.
<br / >
<button onclick="startup()">Initialize</button>
<br / >
Log: <pre id="log" style="border: 1px solid #ccc;"></pre>

function startup() {
 var el = document.getElementsByTagName("canvas")[0];
 el.addEventListener("touchstart", handleStart, false);
 el.addEventListener("touchend", handleEnd, false);
 el.addEventListener("touchcancel", handleCancel, false);
 el.addEventListener("touchmove", handleMove, false);

Useful links: (or in Russian)

Find more questions by tags jQueryJavaScript