Created
May 15, 2011 12:55
-
-
Save arielsalminen/973126 to your computer and use it in GitHub Desktop.
Responsive jQuery slideshow
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
#slideshow { | |
width: 100%; | |
position: relative; | |
} | |
img { | |
top: 0; | |
left: 0; | |
width: 100%; | |
max-width: 600px; | |
height: auto; | |
position: absolute; | |
} |
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
<div id="slideshow"> | |
<img src="1.jpg" /> | |
<img src="2.jpg" /> | |
<img src="3.jpg" /> | |
</div> |
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
$(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
This gist makes it possible to have fluid jQuery slideshow which scales responsively. I am using Jonathan Snook's Simple jQuery Slideshow in this example, but you can really use any JavaScript slideshow solution with this HTML/CSS combo.