I dont know why you havent marked on of these gr8 answers... here is another option which would enable you and anyone else visiting to control transition speed and pause time
JAVASCRIPT
$(function () {
/* SET PARAMETERS */
var change_img_time = 5000;
var transition_speed = 100;
var simple_slideshow = $("#exampleSlider"),
listItems = simple_slideshow.children('li'),
listLen = listItems.length,
i = 0,
changeList = function () {
listItems.eq(i).fadeOut(transition_speed, function () {
i += 1;
if (i === listLen) {
i = 0;
}
listItems.eq(i).fadeIn(transition_speed);
});
};
listItems.not(':first').hide();
setInterval(changeList, change_img_time);
});
.
HTML
<ul id="exampleSlider">
<li><img src="http://placehold.it/500x250" alt="" /></li>
<li><img src="http://placehold.it/500x250" alt="" /></li>
<li><img src="http://placehold.it/500x250" alt="" /></li>
<li><img src="http://placehold.it/500x250" alt="" /></li>
</ul>
.
If your keeping this simple its easy to keep it resposive
best to visit the: DEMO
.
If you want something with special transition FX (Still responsive) - check this out
DEMO WITH SPECIAL FX
Here is my adaptation of Michael Soriano's tutorial. See below or in JSBin.
$(function() {_x000D_
var theImage = $('ul#ss li img');_x000D_
var theWidth = theImage.width();_x000D_
//wrap into mother div_x000D_
$('ul#ss').wrap('<div id="mother" />');_x000D_
//assign height width and overflow hidden to mother_x000D_
$('#mother').css({_x000D_
width: function() {_x000D_
return theWidth;_x000D_
},_x000D_
height: function() {_x000D_
return theImage.height();_x000D_
},_x000D_
position: 'relative',_x000D_
overflow: 'hidden'_x000D_
});_x000D_
//get total of image sizes and set as width for ul _x000D_
var totalWidth = theImage.length * theWidth;_x000D_
$('ul').css({_x000D_
width: function() {_x000D_
return totalWidth;_x000D_
}_x000D_
});_x000D_
_x000D_
var ss_timer = setInterval(function() {_x000D_
ss_next();_x000D_
}, 3000);_x000D_
_x000D_
function ss_next() {_x000D_
var a = $(".active");_x000D_
a.removeClass('active');_x000D_
_x000D_
if (a.hasClass('last')) {_x000D_
//last element -- loop_x000D_
a.parent('ul').animate({_x000D_
"margin-left": (0)_x000D_
}, 1000);_x000D_
a.siblings(":first").addClass('active');_x000D_
} else {_x000D_
a.parent('ul').animate({_x000D_
"margin-left": (-(a.index() + 1) * theWidth)_x000D_
}, 1000);_x000D_
a.next().addClass('active');_x000D_
}_x000D_
}_x000D_
_x000D_
// Cancel slideshow and move next manually on click_x000D_
$('ul#ss li img').on('click', function() {_x000D_
clearInterval(ss_timer);_x000D_
ss_next();_x000D_
});_x000D_
_x000D_
});
_x000D_
* {_x000D_
margin: 0;_x000D_
padding: 0;_x000D_
}_x000D_
#ss {_x000D_
list-style: none;_x000D_
}_x000D_
#ss li {_x000D_
float: left;_x000D_
}_x000D_
#ss img {_x000D_
width: 200px;_x000D_
height: 100px;_x000D_
}
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>_x000D_
<ul id="ss">_x000D_
<li class="active">_x000D_
<img src="http://leemark.github.io/better-simple-slideshow/demo/img/colorado-colors.jpg">_x000D_
</li>_x000D_
<li>_x000D_
<img src="http://leemark.github.io/better-simple-slideshow/demo/img/monte-vista.jpg">_x000D_
</li>_x000D_
<li class="last">_x000D_
<img src="http://leemark.github.io/better-simple-slideshow/demo/img/colorado.jpg">_x000D_
</li>_x000D_
</ul>
_x000D_
This lookslike something you would be interested in
http://www.designchemical.com/blog/index.php/jquery/jquery-image-swap-gallery/
This is by far the easiest example I have found on the net. http://jonraasch.com/blog/a-simple-jquery-slideshow
Summaring the example, this is what you need to do a slideshow:
HTML:
<div id="slideshow">
<img src="img1.jpg" style="position:absolute;" class="active" />
<img src="img2.jpg" style="position:absolute;" />
<img src="img3.jpg" style="position:absolute;" />
</div>
Position absolute is used to put an each image over the other.
CSS
<style type="text/css">
.active{
z-index:99;
}
</style>
The image that has the class="active" will appear over the others, the class=active property will change with the following Jquery code.
<script>
function slideSwitch() {
var $active = $('div#slideshow IMG.active');
var $next = $active.next();
$next.addClass('active');
$active.removeClass('active');
}
$(function() {
setInterval( "slideSwitch()", 5000 );
});
</script>
If you want to go further with slideshows I suggest you to have a look at the link above (to see animated oppacity changes - 2n example) or at other more complex slideshows tutorials.
Source: Stackoverflow.com