Skip to content

Commit

Permalink
added an if statement to catch when we click the last cup to toggle it
Browse files Browse the repository at this point in the history
  • Loading branch information
lexx54 committed Dec 11, 2020
1 parent a3282f9 commit 372af07
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drink-water/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ smallCups.forEach((cup, idx) => {
})

function highlightCups(idx) {
if (idx===7 && smallCups[idx].classList.contains("full")) idx--;
if(smallCups[idx].classList.contains('full') && !smallCups[idx].nextElementSibling.classList.contains('full')) {
idx--
}
Expand Down

0 comments on commit 372af07

Please sign in to comment.