28 lines
670 B
JavaScript
28 lines
670 B
JavaScript
{1461462d29ad288cb0eac9a426059858dfcd1079 true 670 main.js 0xc001f97650}
(function(){
|
|
const buttons = document.querySelectorAll('.btn');
|
|
let count = 0;
|
|
|
|
buttons.forEach(function(button){
|
|
button.addEventListener('click', function(){
|
|
if(button.classList.contains('prevBtn')){
|
|
count--
|
|
}
|
|
else if(button.classList.contains('nextBtn')){
|
|
count++
|
|
}
|
|
const counter = document.querySelector("#counter");
|
|
counter.textContent = count
|
|
|
|
if(count < 0){
|
|
counter.style.color = 'red'
|
|
}
|
|
else if(count > 0){
|
|
counter.style.color = "green"
|
|
}
|
|
else{
|
|
counter.style.color = "#333333"
|
|
}
|
|
})
|
|
})
|
|
// statements
|
|
}) () |