From 2c4a7fed227c3f81cfc45381bde0f9ff36b12ae5 Mon Sep 17 00:00:00 2001 From: Pavel Kosko Date: Wed, 30 May 2018 17:10:48 +0300 Subject: [PATCH] Add ability to close menu on touch devices --- contextMenu.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contextMenu.js b/contextMenu.js index c798590..9431d45 100644 --- a/contextMenu.js +++ b/contextMenu.js @@ -510,7 +510,7 @@ } function removeAllContextMenus(e) { - $document.find('body').off('mousedown', removeOnOutsideClickEvent); + $document.find('body').off('mousedown touchstart', removeOnOutsideClickEvent); $document.off('scroll', removeOnScrollEvent); $(_clickedElement).removeClass('context'); removeContextMenus(); @@ -579,7 +579,7 @@ } // Remove if the user clicks outside - $document.find('body').on('mousedown', removeOnOutsideClickEvent); + $document.find('body').on('mousedown touchstart', removeOnOutsideClickEvent); // Remove the menu when the scroll moves $document.on('scroll', removeOnScrollEvent);