我是jQuery的新手,我正在尝试创建一个幻灯片。我创建了它,但是当计时器改变我的图片时,所有的页面似乎都被刷新了。
HTML示例
<div class="slide">
<img id="scroll_image" src="img/rooms/suite5.jpg" width="1000" height="350" alt="hotel-suite-1" class="show" />
<img id="scroll_image" src="img/rooms/suite1.jpg" width="1000" height="350" alt="hotel-suite-2" />
<img id="scroll_image" src="img/rooms/suite2.jpg" width="1000" height="350" alt="hotel-suite-3" />
<img id="scroll_image" src="img/rooms/suite3.jpg" width="1000" height="350" alt="hotel-suite-4" />
<img id="scroll_image" src="img/rooms/suite4.jpg" width="1000" height="350" alt="hotel-suite-5" />
</div><!--end of slide-->jQuery实例
$(document).ready(function() {
slideShow();
});
function slideShow() {
var current = $('.slide .show');
var next = current.next().length ? current.next() : current.parent().children(':first');
current.hide().removeClass('show');
next.fadeIn().addClass('show');
setTimeout(slideShow, 6000);
}您可以看到我的意思,如果您单击此处,向下滚动页面,并等待计时器改变图像!?
发布于 2013-11-08 18:29:04
不是你的页面让人耳目一新。您的页面由于某种原因每次滑动图像时都会滚动。
您的问题是正在使用的jquery 1.5.1.js。
更新您的jQuery到最新版本,问题将得到解决:)您还可以使用最新的外部jquery链接:
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>jsFiddle与您的jQuery版本
具有最新版本的jsFiddle (使用了上面所示的最新外部链接)
祝你好运!
https://stackoverflow.com/questions/19865165
复制相似问题