update remove index

This commit is contained in:
Thanapat 2025-02-13 11:11:53 +07:00
parent f0fc790e60
commit 75e5dc44c3

View File

@ -68,15 +68,17 @@ const messages = [
]; ];
let messageIndex = 0; let messageIndex = 0;
let removeIndex = 0;
function handleNoClick() { function handleNoClick() {
const noButton = document.querySelector('.no-button'); const noButton = document.querySelector('.no-button');
const yesButton = document.querySelector('.yes-button'); const yesButton = document.querySelector('.yes-button');
noButton.textContent = messages[messageIndex]; noButton.textContent = messages[messageIndex];
messageIndex = (messageIndex + 1) % messages.length; messageIndex = (messageIndex + 1) % messages.length;
removeIndex++;
const currentSize = parseFloat(window.getComputedStyle(yesButton).fontSize); const currentSize = parseFloat(window.getComputedStyle(yesButton).fontSize);
yesButton.style.fontSize = `${currentSize * 1.5}px`; yesButton.style.fontSize = `${currentSize * 1.5}px`;
if(messageIndex>messages.length*2) document.querySelector('.no-button').remove() if(removeIndex>messages.length*2) document.querySelector('.no-button').remove()
} }
function handleYesClick() { function handleYesClick() {