Skip to content

Commit

Permalink
✨ feat: dino 카운트 다운 css 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
wldnjs7064 committed Apr 29, 2024
1 parent 97ec42e commit a69bbc8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
21 changes: 19 additions & 2 deletions css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,24 @@ body {
left: 50%;
transform: translate(-50%, -50%);
font-size: 2.5rem;
color: red;
color: white;
z-index: 9999;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
text-shadow: 0 0 10px rgba(255, 255, 0, 0.9);
}

#count-number {
font-size: 30px;
text-shadow: 0 0 10px rgba(255, 255, 0, 0.9);
margin-bottom: 20px;
}

#count-down p:nth-of-type(1) {
font-size: 17px;
margin-bottom: 20px;
text-shadow: 0 0 10px rgba(255, 255, 0, 0.9);
}

#count-down p:nth-of-type(3) {
font-size: 27px;
color: yellow;
}
5 changes: 4 additions & 1 deletion js/dinosaur/dinosaur.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ function updateGameContent() {
</div>
</div>
<div id="count-down" class="count-down hide">1</div>
<div id="count-down" class="count-down hide">
<p id="count-number">0</p>
</div>
`;

loadScript("js/dinosaur/main.js");
Expand Down
10 changes: 7 additions & 3 deletions js/dinosaur/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,18 @@
let count = 10;
countdown = document.createElement("div"); // 전역 변수 countdown에 할당
countdown.id = "count-down";
countdown.textContent = count;
countdown.style.display = "block";
console.log(countdown.style.display);

countdownInterval = setInterval(() => {
count--;
console.log(count);
countdown.textContent = count;
document.getElementById("count-number").textContent = count;
countdown.innerHTML = `
<p>CONTINUE?</p>
<p id="count-number">${count}</p>
<p>INSERT COIN</p>
`;
count--;
if (count === 0) {
clearInterval(countdownInterval);
// 10초 카운트가 끝나면 아래 코드 실행
Expand Down

0 comments on commit a69bbc8

Please sign in to comment.