fade effect code example
Example 1: css fade in
.fade-in {
animation: fadeIn 2s;
opacity: 1;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
Example 2: animation fade in css
#test p {
margin-top: 25px;
font-size: 21px;
text-align: center;
-webkit-animation: fadein 2s;
-moz-animation: fadein 2s;
-ms-animation: fadein 2s;
-o-animation: fadein 2s;
animation: fadein 2s;
}
@keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
@-moz-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
@-webkit-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
@-ms-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
@-o-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
Example 3: fadein fadeout jquery
$('.btn-cart').click(function(e) {
e.preventDefault();
$('.cartlist').fadeIn().addClass('active');
});
$('.btn-cartlist-close').click(function() {
$('.cartlist').removeClass('active').fadeOut();
});
Example 4: fade in css
<style>
.fade-css-example {
animation: fade-animation-example ease 10s;
}
@keyframes fade-animation-example {
0% {
opacity:0;
}
100% {
opacity:1;
}
}
</style>
<div class="fade-css-example">
<img src="image (1).jpg">
</div>