Forum Moderators: open
<div>WE OFFER MANY PRODUCTS INCLUDING
<span class="txt-flipper-src">clothes</span>
<span class="txt-flipper-src hidden">electronics</span>
<span class="txt-flipper-src hidden">etc.</span>
</div>
.hidden {
display: none !important;
}
let txtFlipperSrc = document.querySelectorAll('.txt-flipper-src');
let idxSrc = 0;
setInterval(function () {
// hide current, unhide next
txtFlipperSrc[idxSrc].classList.toggle('hidden');
idxSrc = txtFlipperSrc.length - 1 === idxSrc ? 0 : idxSrc + 1;
txtFlipperSrc[idxSrc].classList.toggle('hidden');
}, 3000);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">
<title>untitled document</title>
<!--<link rel="stylesheet" href="screen.css" media="screen">-->
<style media="screen">
#offers {
position: relative;
}
#offers span {
position: absolute;
margin-left: 0.5em;
opacity: 0;
animation: words 9s infinite;
}
#offers span:nth-child(2){ animation-delay: 3s; }
#offers span:nth-child(3){ animation-delay: 6s; }
@keyframes words {
0% { opacity:1; }
33.33% { opacity:1; }
33.34% { opacity:0; }
}
</style>
</head>
<body>
<p id="offers">
WE OFFER MANY PRODUCTS INCLUDING
<span>CLOTHES.</span>
<span>ELECTRONICS.</span>
<span>FURNITURE.</span>
</p>
</body>
</html>