fixed a bug accurs when clicking first cup

Bug accurs if you have more than one cup filled and try to click first cup.
pull/32/head
Cihat Uysal 5 years ago committed by GitHub
parent 3a874928d3
commit c7f0f52fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,8 +11,14 @@ 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--
if (smallCups[idx] === smallCups[0]) {
cup.classList.remove("full");
smallCups[idx].classList.add("full");
} else if (
smallCups[idx].classList.contains("full") &&
!smallCups[idx].nextElementSibling.classList.contains("full")
) {
idx--;
}
smallCups.forEach((cup, idx2) => {
@ -46,4 +52,4 @@ function updateBigCup() {
remained.style.visibility = 'visible'
listers.innerText = `${2 - (250 * fullCups / 1000)}L`
}
}
}

Loading…
Cancel
Save