This demo was inspired by Alberto Garcia Ariza.
The demo was found on CodePen.
The demo was created on April 8, 2024.
This demo animates list items using CSS. Each list item is pushed into view when it is scrolled on top of and is pushed away and faded when it is scrolled away from.
This demo is interesting because it shows a way to make lists interactive and it allows for emphasis. Someone may want to use this demo when they do not want to show all list items all at once, but want to emphasize each list item one by one.
<ul class="example-list">
<li class="item">List Item 1</li>
<li class="item">List Item 2</li>
<li class="item">List Item 3</li>
<li class="item">List Item 4</li>
<li class="item">List Item 5</li>
<li class="item">List Item 6</li>
<li class="item">List Item 7</li>
<li class="item">List Item 8</li>
<li class="item">List Item 9</li>
<li class="item">List Item 10</li>
</ul>
@keyframes pushin-pushout{
entry 0% {
opacity: 0;
translate: 100% 0;
}
entry 100% {
opacity: 1;
translate: 0 0;
}
exit 0% {
opacity: 1;
translate: 0 0;
}
exit 100% {
opacity: 0;
translate: 100% 0;
}
}
.example-list {
list-style: none;
height: 100px;
color: white;
font-size: 2em;
overflow-y: scroll;
overflow-x: hidden;
}
.item {
background: #135e17;
padding: 0.5em;
margin-bottom: 3px;
animation: linear pushin-pushout;
animation-timeline: view();
}
View Demo