Skip to content

Instantly share code, notes, and snippets.

@JonasRothmann
Created March 23, 2018 22:15
Show Gist options
  • Save JonasRothmann/3236133b160a083537a885ef5bb2b7bb to your computer and use it in GitHub Desktop.
Save JonasRothmann/3236133b160a083537a885ef5bb2b7bb to your computer and use it in GitHub Desktop.
XEajYe
<img src="http://oi64.tinypic.com/wmo0vd.jpg" alt="" style="opacity: 0"/>
<img src="http://oi68.tinypic.com/1444azd.jpg" alt="" style="opacity: 0" />
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)
}
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