안녕하세요 저는 여기에 데모가있는 메모리 게임이 있습니다.Javascript 메모리 카드 게임 마지막 카드가 뒤집히지 않습니다
https://kuochye.github.io/memorygame/
나는 마지막 카드를 뒤집어서하지와 문제가 왜 알아낼 수 없습니다.
document.querySelectorAll(".flip-container").forEach(card => card.classList.add("clicked"));
setTimeout(function() {
document.querySelectorAll(".flip-container").forEach(card =>
card.classList.remove("clicked"));
}, 30000);
^이것은 카드가 내려 가기 전에 30 초 동안 카드를 보여 주려고 한 것입니다. 하지만 어떻게 든 마지막 카드가 보이지 않습니다.
// Build single card
var buildCardNode = function (index, value, isRevealed, width, height) {
var flipContainer = document.createElement("li");
var flipper = document.createElement("div");
var front = document.createElement("a");
var back = document.createElement("a");
flipContainer.index = index;
flipContainer.style.width = width;
flipContainer.style.height = height;
flipContainer.classList.add("flip-container");
if (isRevealed) {
flipContainer.classList.add("clicked");
}
flipper.classList.add("flipper");
front.classList.add("front");
front.setAttribute("href", "#");
back.classList.add("back");
back.classList.add("card-" + value);
back.setAttribute("href", "#");
flipper.appendChild(front);
flipper.appendChild(back);
flipContainer.appendChild(flipper);
flipContainer.addEventListener('click', handleFlipCard);
document.querySelectorAll(".flip-container").forEach(card => card.classList.add("clicked"));
setTimeout(function() {
document.querySelectorAll(".flip-container").forEach(card =>
card.classList.remove("clicked"));
}, 30000);
return flipContainer;
};
지금은 완전히 의미가 있습니다! 옵션 b는 간단하고 완벽했습니다! 정말 고맙습니다. – Kayden