Fixed animation and color change of habit progress bar
This commit is contained in:
parent
1180893dd1
commit
0f060e81a4
@ -177,11 +177,14 @@
|
|||||||
var habitBlock = document.getElementById("habit-" + habitId);
|
var habitBlock = document.getElementById("habit-" + habitId);
|
||||||
|
|
||||||
if (percentage == 100) {
|
if (percentage == 100) {
|
||||||
progressBar.style.backgroundColor = "green";
|
|
||||||
habitBlock.classList.add("animate-bounce");
|
habitBlock.classList.add("animate-bounce");
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
habitBlock.classList.remove("animate-bounce");
|
habitBlock.classList.remove("animate-bounce");
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (percentage >= 100) {
|
||||||
|
progressBar.style.backgroundColor = "green";
|
||||||
} else {
|
} else {
|
||||||
progressBar.style.backgroundColor = "";
|
progressBar.style.backgroundColor = "";
|
||||||
habitBlock.classList.remove("animate-bounce");
|
habitBlock.classList.remove("animate-bounce");
|
||||||
@ -209,7 +212,9 @@
|
|||||||
var percentage = response.data.percentage;
|
var percentage = response.data.percentage;
|
||||||
var progressBar = document.getElementById("progress-bar-" + habitId);
|
var progressBar = document.getElementById("progress-bar-" + habitId);
|
||||||
progressBar.style.width = percentage + "%";
|
progressBar.style.width = percentage + "%";
|
||||||
|
if (response.data.unchecked) {
|
||||||
checkCompletionAndAnimate(habitId, percentage);
|
checkCompletionAndAnimate(habitId, percentage);
|
||||||
|
}
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
// Handle the error if needed
|
// Handle the error if needed
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user