A Pen by Jonas Rothmann on CodePen.
Created
March 23, 2018 22:15
-
-
Save JonasRothmann/3236133b160a083537a885ef5bb2b7bb to your computer and use it in GitHub Desktop.
XEajYe
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
<img src="http://oi64.tinypic.com/wmo0vd.jpg" alt="" style="opacity: 0"/> | |
<img src="http://oi68.tinypic.com/1444azd.jpg" alt="" style="opacity: 0" /> |
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
var images = document.querySelectorAll("img"); | |
var current = 0; | |
var max = images.length - 1; | |
loop(); | |
function loop() { | |
images[current].style.opacity = 0; | |
current == max ? current = 0 : current++; | |
images[current].style.opacity = 1; | |
console.log(max); | |
setTimeout(loop, 12000) | |
} |
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
html, body | |
padding: 0 | |
margin: 0 | |
width: 255px | |
height: 105px | |
background: #000 | |
position: relative | |
img | |
padding: 21px | |
box-sizing: border-box | |
height: 105px | |
position: absolute | |
top: 0 | |
left: 50% | |
transform: translateX(-50%) | |
width: auto | |
transition: all 1.3s ease-in-out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment