Skip to content

Instantly share code, notes, and snippets.

@yoanmarchal
Forked from arielsalminen/responsive.css
Created January 9, 2013 14:01
Show Gist options
  • Save yoanmarchal/4493312 to your computer and use it in GitHub Desktop.
Save yoanmarchal/4493312 to your computer and use it in GitHub Desktop.
responsive slider css + jquery
#slideshow {
width: 100%;
position: relative;
}
img {
top: 0;
left: 0;
width: 100%;
max-width: 600px;
height: auto;
position: absolute;
}
<div id="slideshow">
<img src="1.jpg" />
<img src="2.jpg" />
<img src="3.jpg" />
</div>
$(function () {
// Simplest jQuery slideshow by Jonathan Snook
$('#slideshow img:gt(0)').hide();
setInterval(function () {
$('#slideshow :first-child').fadeOut(1000)
.next('img').fadeIn(1000).end().appendTo('#slideshow');
}, 4000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment