This sentence is scrolling
The CSS markup is unchanged, but Javascript for a button was added.
button.addEventListener("click", () => {
const isRunning = marqueeText.style.animationPlayState == "running";
// change behaviour of animation and button
if (isRunning) {
// stop the animation
marqueeText.style.animationPlayState = "paused";
// change button text
button.innerText = "Play";
button.ariaPressed = "true";
} else {
// start the animation
marqueeText.style.animationPlayState = "running";
// change button text
button.innerText = "Pause";
button.ariaPressed = "false";
}
});
Code copied from HTMHell