Skip to content

Commit 16b208d

Browse files
committed
bootstrap modal added
1 parent ed2b6a1 commit 16b208d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

snake.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ canvas {
8282
margin-bottom: 20px;
8383
}
8484

85-
#alertMsg {
85+
#scoreModal {
8686
color: brown;
8787
font-weight: bolder;
8888
}

snake.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h2 class="mt-3"><span class="result"><img src="images/apple.png" alt="fruit"></
3333
<div class="modal-content">
3434
<div class="modal-body">
3535
<img id="snake" src="images/snake.png" alt="snake">
36-
<p>Game Over! Your Score is: <span id="alertMsg"></span></p>
36+
<p>Game Over! Your Score is: <span id="scoreModal"></span></p>
3737
</div>
3838
<div class="modal-footer">
3939
<button type="button" class="btn modal-btn" data-dismiss="modal">Ok</button>

snake.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ var playing, gameStarted;
2121
var boundaryCollision;
2222
var tail0;
2323

24-
var alertModal = document.getElementById("alertModal");
25-
var alertMsg = document.getElementById("alertMsg");
26-
var modalBtn = document.querySelector(".modal-btn");
24+
// var alertModal = document.getElementById("alertModal");
25+
// var alertMsg = document.getElementById("alertMsg");
26+
// var modalBtn = document.querySelector(".modal-btn");
2727

2828

2929
startBtn.addEventListener("click", startGame);
@@ -242,7 +242,7 @@ function drawSnake() {
242242
}
243243
drawSnakeHead("red");
244244
setTimeout(()=>{
245-
alertMsg.textContent = totalTail;
245+
scoreModal.textContent = totalTail;
246246
$('#alertModal').modal('show');
247247
$( "#alertModal" ).on('shown.bs.modal', function(){
248248
window.removeEventListener("keydown", pressedKey);

0 commit comments

Comments
 (0)