Я нашел этот простой код jQuery
для слайд-шоу из этого блога.Как добавить предыдущую и следующую кнопку в простой код слайд-шоу jquery
http://leavesofcode.net/2012/08/17/simple-slideshow/
Он отлично работает в проекте я работаю прямо сейчас, где я могу назвать изображения с jQuery load()
функции и слайд-шоу по-прежнему работает. Хотя я хотел бы реализовать предыдущую и следующую кнопку в том же коде, если это возможно. Любая помощь могла бы быть полезна. Пожалуйста, помогите спасибо.
Вот код: http://jsfiddle.net/mblase75/CRUJJ/
<script>
$(document).ready(function() {
setInterval(function() {
var $curr = $('.slideshow img:visible'), // should be the first image
$next = ($curr.next().length) ? $curr.next() : $('.slideshow img').first();
// if there isn't a next image, loop back to the first image
$next.css('z-index',2).fadeIn('slow', function() { // move it to the top
$curr.hide().css('z-index',0); // move this to the bottom
$next.css('z-index',1); // now move it to the middle
});
}, 6000); // milliseconds
});
</script>
<div class="slideshow">
<img src="first-image.jpg" width="500" height="100" alt="first image">
<img src="second-image.jpg" width="500" height="100" alt="second image">
<img src="third-image.jpg" width="500" height="100" alt="third image">
<img src="fourth-image.jpg" width="500" height="100" alt="fourth image">
</div>
<style>
.slideshow {
position: relative; /* necessary to absolutely position the images inside */
width: 500px; /* same as the images inside */
height: 100px;
}
.slideshow img {
position: absolute;
display: none;
}
.slideshow img:first-child {
display: block; /* overrides the previous style */
}
</style>
Спасибо за это замечательное решение. Он работает отлично. – Omzep