Compelte page
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Animated Text Sequence with Static Disappearance</title>
<style>
.email-opt-container {
position: relative;
height: 50px;
overflow: hidden;
}
.email-opt-msg {
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
align-items: center;
opacity: 0;
transition: opacity 0.5s ease-in-out;
}
.email-opt-msg.active {
opacity: 1;
}
.icon-arrow-up {
opacity: 0;
transform: translateY(20px);
transition: opacity 0.3s ease-out, transform 0.3s ease-out;
margin-right: 10px;
}
.icon-arrow-up.visible {
opacity: 1;
transform: translateY(0);
}
.opt-msg-para {
margin: 0;
}
</style>
</head>
<body>
<div class="email-opt-container">
<div class="email-opt-msg">
<img class="icon-arrow-up" width="24" height="24" src="https://img.icons8.com/ios-filled/50/long-arrow-up.png" alt="long-arrow-up"/>
<p class="opt-msg-para">30% bessere Chancen auf einen Arbeitsplatz*</p>
</div>
<div class="email-opt-msg">
<img class="icon-arrow-up" width="24" height="24" src="https://img.icons8.com/ios-filled/50/long-arrow-up.png" alt="long-arrow-up"/>
<p class="opt-msg-para">42% mehr Rückmeldungen von HR-Teams*</p>
</div>
<div class="email-opt-msg">
<img class="icon-arrow-up" width="24" height="24" src="https://img.icons8.com/ios-filled/50/long-arrow-up.png" alt="long-arrow-up"/>
<p class="opt-msg-para">50% bessere Chancen auf den Traumjob*</p>
</div>
</div>
<script>
const messages = document.querySelectorAll('.email-opt-msg');
let currentIndex = 0;
function showMessage(index) {
const message = messages[index];
const arrow = message.querySelector('.icon-arrow-up');
message.classList.add('active');
setTimeout(() => {
arrow.classList.add('visible');
}, 500);
}
function hideMessage(index) {
const message = messages[index];
const arrow = message.querySelector('.icon-arrow-up');
arrow.style.transition = 'opacity 0.3s ease-out';
arrow.style.opacity = '0';
message.classList.remove('active');
}
function animateMessages() {
hideMessage(currentIndex);
setTimeout(() => {
currentIndex = (currentIndex + 1) % messages.length;
showMessage(currentIndex);
setTimeout(animateMessages, 3000);
}, 1000);
}
showMessage(0);
setTimeout(animateMessages, 3000);
</script>
</body>
</html>
Public Last updated: 2024-10-10 06:23:58 AM