From 06cf7cb573744101dbcd8057a8b4c059907bf1aa Mon Sep 17 00:00:00 2001 From: Max Lehmann Date: Thu, 11 Jun 2020 12:14:35 +0200 Subject: [PATCH] Update '12/dragable.js' --- 12/dragable.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/12/dragable.js b/12/dragable.js index 161273f..9508d73 100644 --- a/12/dragable.js +++ b/12/dragable.js @@ -80,11 +80,11 @@ makeDragable('#shell_03header', '#shell_03') if (x.type=="mousedown") { xOffset2 = x.clientX - rect.left; //clientX and getBoundingClientRect() both use viewable area adjusted when scrolling aka 'viewport' yOffset2 = x.clientY - rect.top; - window.addEventListener('mousemove', dragObject2, true); + window.addEventListener('mousemove', dragObject, true); } else if(e.type=="touchstart") { xOffset2 = x.targetTouches[0].clientX - rect.left; yOffset2 = x.targetTouches[0].clientY - rect.top; - window.addEventListener('touchmove', dragObject2, true); + window.addEventListener('touchmove', dragObject, true); } } @@ -93,7 +93,7 @@ makeDragable('#shell_03header', '#shell_03') x.preventDefault(); x.stopPropagation(); - if(dragObj == null) { + if(dragObj2 == null) { return; // if there is no object being dragged then do nothing } else if(x.type=="mousemove") { dragObj2.style.left = x.clientX-xOffset2 +"px"; // adjust location of dragged object so doesn't jump to mouse position