我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> …Run Code Online (Sandbox Code Playgroud)