Last active
October 26, 2016 12:37
-
-
Save hkjels/a6490d866157e930836bd60c71320de7 to your computer and use it in GitHub Desktop.
Slideshow
This file contains 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
<!doctype> | |
<html> | |
<head> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> | |
<link rel="stylesheet" href="./slideshow.css"> | |
<title>Slideshow</title> | |
</head> | |
<body> | |
<div class="slideshow"> | |
<img src="https://files.slack.com/files-pri/T0DB7B8US-F2TTMTJG6/toppbilde_10mot2020_1920x400_06.jpg?pub_secret=d038f6b149"> | |
<img src="https://files.slack.com/files-pri/T0DB7B8US-F2UCX5FFH/toppbilde_10mot2020_1920x400_04.jpg?pub_secret=fb73bc730a"> | |
<img src="https://files.slack.com/files-pri/T0DB7B8US-F2TU4P3HQ/toppbilde_10mot2020_1920x400_01.jpg?pub_secret=d5cc43447f"> | |
<img src="https://files.slack.com/files-pri/T0DB7B8US-F2UCYADMX/toppbilde_10mot2020_1920x400_02.jpg?pub_secret=bf379d793c"> | |
</div> | |
</body> | |
</html> |
This file contains 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
.slideshow { | |
background: black; | |
height: 300px; | |
overflow: hidden; | |
position: relative; | |
width: 100%; | |
} | |
.slideshow img { | |
animation: show 48s infinite; | |
height: 100%; | |
opacity: 0; | |
position: absolute; | |
transform: translateZ(0); | |
} | |
@keyframes show { | |
10% { | |
opacity: 1; | |
} | |
30% { | |
opacity: 1; | |
transform: scale(1.3); | |
} | |
40% { | |
opacity: 0; | |
} | |
} | |
img:nth-child(1) { | |
animation-delay: 36s; | |
} | |
img:nth-child(2) { | |
animation-delay: 24s; | |
} | |
img:nth-child(3) { | |
animation-delay: 12s; | |
} | |
img:nth-child(4) { | |
animation-delay: 0s; | |
} |
This file contains 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
$slides: 4; | |
$slide_duration: 12; | |
$duration: $slide_duration * $slides; | |
.slideshow { | |
background: black; | |
height: 300px; | |
overflow: hidden; | |
position: relative; | |
width: 100%; | |
} | |
.slideshow img { | |
animation: show #{$duration}s infinite; | |
height: 100%; | |
opacity: 0; | |
position: absolute; | |
transform: translateZ(0); | |
} | |
@keyframes show { | |
10% { | |
opacity: 1; | |
} | |
30% { | |
opacity: 1; | |
transform: scale(1.3); | |
} | |
40% { | |
opacity: 0; | |
} | |
} | |
@for $i from 1 to $slides + 1 { | |
img:nth-child(#{$i}) { | |
animation-delay:#{$duration - $slide_duration * $i}s | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment