From 1c163fe12ff15a21c6e5d5987077fbabd11f3336 Mon Sep 17 00:00:00 2001 From: TheGeniusOfEternity Date: Thu, 8 Aug 2024 19:01:03 +0300 Subject: [PATCH] 1.1 multiple touch fix --- main.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index 2f903b3..0957f53 100644 --- a/main.js +++ b/main.js @@ -10,12 +10,15 @@ const checkMatched = () => { } } async function lol() { - this.classList.add('active') - const activeCards = document.querySelectorAll('.active') - - await delay(500) + let activeCards = document.querySelectorAll('.active') + if (activeCards.length < 2) { + this.classList.add('active') + activeCards = document.querySelectorAll('.active') + await delay(500) + } if (activeCards.length === 2) { + if (activeCards[0].classList[1] === activeCards[1].classList[1]) { console.log("Great!") activeCards[0].classList.add('matched')