Created
April 20, 2017 09:37
-
-
Save alberto-marin/f9acfe5d1cbe3afcf954deba08c81431 to your computer and use it in GitHub Desktop.
Carousel css
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 code: | |
<div class="carousel__frame"> | |
<div class="carousel"> | |
<img class="active" src="./images/500px-Prime-76414647.jpg" alt="" width="320px" height="160px"> | |
<img class="active" src="./images/500px-Prime-95484115.jpg" alt="" width="320px" height="160px"> | |
<img class="active" src="./images/500px-Prime-85409619.jpg" alt="" width="320px" height="160px"> | |
<img class="active" src="./images/500px-Prime-76414647.jpg" alt="" width="320px" height="160px"> | |
</div> | |
</div> | |
SCSS code: | |
.carousel { | |
display: flex; | |
flex-direction: row; | |
&__frame { | |
width: 320px; | |
overflow: hidden; | |
} | |
} | |
.active { | |
animation: push 8s linear infinite; | |
} | |
@keyframes push { | |
0% {transform: translateX(0);} | |
10% {transform: translateX(0);} | |
25% { transform: translateX(-100%); } | |
45% { transform: translateX(-100%); } | |
60% { transform: translateX(-200%); } | |
75% { transform: translateX(-200%); } | |
90% { transform: translateX(-300%); } | |
100% { transform: translateX(-300%); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment