css animation fade out after delay
<style>
#text{
transition-duration:1s; /* <= creates fade out effect */
transition-delay:1s;
}
</style>
<p onclick="this.style.opacity=0" id="text">My text</p>
css animation fade out after delay
<style>
#text{
transition-duration:1s; /* <= creates fade out effect */
transition-delay:1s;
}
</style>
<p onclick="this.style.opacity=0" id="text">My text</p>
vanilla javascript fade out
<div id="target">Click to fade</div>
<script>
function fadeOutEffect() {
var fadeTarget = document.getElementById("target");
var fadeEffect = setInterval(function () {
if (!fadeTarget.style.opacity) {
fadeTarget.style.opacity = 1;
}
if (fadeTarget.style.opacity > 0) {
fadeTarget.style.opacity -= 0.1;
} else {
clearInterval(fadeEffect);
}
}, 200);
}
document.getElementById("target").addEventListener('click', fadeOutEffect)
</script>
<style>
#target {
height: 100px;
background-color: red;
}
</style>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us