how to make this automatically reveal the text without the button?

Viewed 46

how can I make the animation below to reveal the text without playing the button? Thank you.


const reveal = document.querySelector('.reveal-wrapper')

const playBtn = document.querySelector('.play')

playBtn.addEventListener('click', () => {
reveal.classList.add('reveal-wrapper-ani')
setTimeout(() => {
 reveal.classList.remove('reveal-wrapper-ani')
}, 1000)
})

1 Answers

You just need to remove the event listener and apply its actions on the loading script:

const reveal = document.querySelector('.reveal-wrapper')

reveal.classList.add('reveal-wrapper-ani')
setTimeout(() => {
 reveal.classList.remove('reveal-wrapper-ani')
}, 1000)
Related