From 8e4a7ba80e0c6dc475a36e5c9c0983a2762b7eaf Mon Sep 17 00:00:00 2001 From: nicofrand Date: Sat, 1 Sep 2018 10:35:55 +0200 Subject: [PATCH] Fix regression on mobile: overlay not clickable --- portal/assets/js/ynhpanel.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/portal/assets/js/ynhpanel.js b/portal/assets/js/ynhpanel.js index 1adaa8e..534dd65 100644 --- a/portal/assets/js/ynhpanel.js +++ b/portal/assets/js/ynhpanel.js @@ -123,9 +123,6 @@ var dragg = function(id) { this.x_elem = 0, this.y_elem = 0; // Stores top, left values (edge) of the element var _initDrag = function(e){ - // Prevent firefox native D'n'D behavior - window.eventPreventDefault(e); - if (e.type === "touchstart"){ x_pos = e.touches[0].clientX; y_pos = e.touches[0].clientY; @@ -157,6 +154,11 @@ var dragg = function(id) { } }; + // Prevent native D'n'D behavior + window.addEvent(elem, 'dragstart', function(e){ + window.eventPreventDefault(e); + }); + // Start dragging window.addEvent(elem, 'mousedown', _initDrag); window.addEvent(elem, 'touchstart', _initDrag); @@ -175,7 +177,7 @@ var dragg = function(id) { // Prevent default event window.eventPreventDefault(e); - // Do not prapagate to other click event if dragged out + // Do not propagate to other click event if dragged out if (dragged) { e.stopImmediatePropagation(); }