Skip to content

Commit

Permalink
Change stars score Dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedElaguab committed Oct 23, 2018
1 parent 3b92098 commit 4400a4f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ deck.appendChild(fragment)
// The *list* of "open" cards
var openCards = [];

// Increment the move counter
// Increment the move counter & Change stars score Dynamically
var moves = 0;
var stars = document.getElementsByClassName('stars')[0];
var movesCounter = function () {

moves += 1;
Expand All @@ -63,6 +64,17 @@ var movesCounter = function () {
var movesEl = document.querySelector('.moves');
movesEl.innerHTML = moves;

// Change stars score Dynamically
if (moves === 16) {

stars.lastElementChild.remove();

} else if (moves === 26) {

stars.lastElementChild.remove();

}

}

// Lock the cards in the open position function
Expand Down

0 comments on commit 4400a4f

Please sign in to comment.