Skip to content

Commit 9aa64f7

Browse files
committed
Touch Fixes
1 parent 205a416 commit 9aa64f7

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106

107107
<div>Background Color:
108108

109-
<input type="color" id="favcolor" name="favcolor" value="rgb(245, 236, 1)" style="border: 1px; border-color: white; cursor:pointer;">
109+
<input type="color" id="favcolor" name="favcolor" value="#f5ec01" style="border: 1px; border-color: white; cursor:pointer;">
110110

111111
</div>
112112
</div>

script.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ dragElement(document.getElementById("settings"));
1313
function dragElement(elmnt) {
1414
let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
1515

16-
// Mouse events
1716
elmnt.onmousedown = dragMouseDown;
18-
19-
// Touch events
2017
elmnt.ontouchstart = dragTouchStart;
2118

2219
function dragMouseDown(e) {
20+
if (["INPUT", "SELECT", "TEXTAREA", "BUTTON", "LABEL"].includes(e.target.tagName)) return;
21+
2322
e.preventDefault();
2423
pos3 = e.clientX;
2524
pos4 = e.clientY;
@@ -38,6 +37,8 @@ function dragElement(elmnt) {
3837
}
3938

4039
function dragTouchStart(e) {
40+
if (["INPUT", "SELECT", "TEXTAREA", "BUTTON", "LABEL"].includes(e.target.tagName)) return;
41+
4142
e.preventDefault();
4243
pos3 = e.touches[0].clientX;
4344
pos4 = e.touches[0].clientY;

0 commit comments

Comments
 (0)