Skip to content

Instantly share code, notes, and snippets.

@clockwork189
Created October 15, 2011 19:37
Show Gist options
  • Save clockwork189/1290044 to your computer and use it in GitHub Desktop.
Save clockwork189/1290044 to your computer and use it in GitHub Desktop.
This is a simple code that allows easy and efficient image transitions.
<script type="text/javascript">
// Render on page load
$(document).ready(function() {
$(function(){
// img_container is the class that holds all the images. See after script tags.
$('.img_container img:gt(0)').hide();
setInterval(function(){
$('.img_container :first-child').fadeOut()
.next('img').fadeIn()
.end().appendTo('.img_container');},
8000);
});
});
</script>
<div class="img_container">
<img src="images/img1.png">
<img src="images/img2.png">
<img src="images/img3.png">
<img src="images/img4.png">
<img src="images/img5.png">
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment