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