Merge pull request #25 from lexx54/water_toggle

added an  if statement to catch when we click the last cup to toggle it
This commit is contained in:
Brad Traversy 2020-12-12 08:39:56 -05:00 committed by GitHub
commit f2462bb1e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,7 @@ smallCups.forEach((cup, idx) => {
}) })
function highlightCups(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')) { if(smallCups[idx].classList.contains('full') && !smallCups[idx].nextElementSibling.classList.contains('full')) {
idx-- idx--
} }