Last active
February 15, 2019 14:00
-
-
Save slavapas/6469cefaf8bf6fc714f4f26c12b5ee09 to your computer and use it in GitHub Desktop.
Zoom Slider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//HTML | |
<div class="slider"> | |
<img src="https://source.unsplash.com/random" alt="" /> | |
<img src="https://source.unsplash.com/category/nature" alt="" /> | |
<img src="https://source.unsplash.com/category/food" alt="" /> | |
<img src="https://source.unsplash.com/category/people" alt="" /> | |
</div> | |
//CSS | |
.slider img { | |
width: 100%; | |
height: auto; | |
position: fixed; | |
top: 0; | |
left: 0; | |
z-index: 100; | |
animation: zoom 36s linear infinite 0s; | |
} | |
.slider img:nth-child(2) { | |
z-index: 99; | |
animation-delay: 9s; | |
} | |
.slider img:nth-child(3) { | |
z-index: 98; | |
animation-delay: 18s; | |
} | |
.slider img:nth-child(4) { | |
z-index: 97; | |
animation-delay: 27s; | |
} | |
@keyframes zoom { | |
0% { | |
opacity: 0; | |
animation-timing-function: ease-in; | |
} | |
5% { | |
opacity: 1; | |
} | |
25% { | |
opacity: 1; | |
} | |
30% { | |
opacity: 0; | |
animation-timing-function: ease-out; | |
} | |
100% { | |
opacity: 0; | |
transform: scale(1.5); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment