Skip to content

Commit

Permalink
limit dots for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
iguannalin committed Oct 2, 2024
1 parent 541faa7 commit 09228cd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,20 @@ window.addEventListener("load", () => {
}
e.preventDefault();
document.body.style.overflow = "hidden";
const dot = document.createElement("dot");

const dots = Array.from(document.getElementsByTagName("dot"));
let dot;
if (dots.length < dotMax) {
dot = document.createElement("dot");
dot.innerText = '.';
document.body.appendChild(dot);
} else {
dot = dots[dotIndex];
dotIndex++;
}
if (dotIndex >= dotMax) dotIndex = 0;
dot.style.left = `${e.targetTouches[0].pageX}px`;
dot.style.top = `${e.targetTouches[0].pageY}px`;
dot.innerText = '.';
document.body.appendChild(dot);
});

Expand Down

0 comments on commit 09228cd

Please sign in to comment.