Загрузить файлы в «/»
This commit is contained in:
parent
9bb690e4f6
commit
15999581a8
20
ratingColor.js
Normal file
20
ratingColor.js
Normal file
@ -0,0 +1,20 @@
|
||||
function updateRating(){
|
||||
let cardVote = document.querySelectorAll('.card__vote');
|
||||
for(let voteCard of cardVote){
|
||||
if (voteCard.innerHTML >= 0 && voteCard.innerHTML <= 3.9) {
|
||||
voteCard.style.color = "red";
|
||||
} else if (voteCard.innerHTML >= 4 && voteCard.innerHTML <= 6.9) {
|
||||
voteCard.style.color = "orange";
|
||||
} else if (voteCard.innerHTML >= 7 && voteCard.innerHTML <= 7.9) {
|
||||
voteCard.style.color = "lightgreen";
|
||||
} else if (voteCard.innerHTML >= 8 && voteCard.innerHTML <= 10) {
|
||||
voteCard.style.color = "lawngreen";
|
||||
}
|
||||
}
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
setTimeout(updateRating, 500);
|
||||
});
|
||||
|
||||
const observer = new MutationObserver(updateRating);
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
Loading…
x
Reference in New Issue
Block a user