Skip to content

Instantly share code, notes, and snippets.

@chadoh
Created February 16, 2016 21:05
Show Gist options
  • Select an option

  • Save chadoh/c79c0e4e08388006c7f3 to your computer and use it in GitHub Desktop.

Select an option

Save chadoh/c79c0e4e08388006c7f3 to your computer and use it in GitHub Desktop.
<li id="1">
<div><img data-src="img1.png"/></div>
<div><img src="img2.png"/></div>
<li>
<script>
jQuery(function() {
setInterval(function() {
// select a random slot to work with. For that slot:
// 1. Ensure that background image `src` attribute is set (load the image)
// 2. Once image is loaded, fade out foreground div (opacity: 0)
// 3. Move foreground div to background
// 4. Change its opacity back to 1 for the next time it's switched
}, 1000);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment