【发布时间】:2016-07-24 16:05:20
【问题描述】:
我正在尝试创建幻灯片并在循环浏览每个图像后重复 each 循环。我已经尝试了所有方法,但在循环浏览每个图像后无法继续循环。请在下面查看我的代码并尝试。
有人有什么想法吗?什么都试过了。
html
<img src="http://elegantthemes.com/preview/InStyle/wp-content/uploads/2008/11/s-1.jpg" />
<img src="http://elegantthemes.com/preview/InStyle/wp-content/uploads/2008/11/s-5.jpg" />
<img src="http://elegantthemes.com/preview/InStyle/wp-content/uploads/2008/11/s-3.jpg" />
js
function test() {
$("img").each(function(index) {
$(this).hide();
$(this).delay(3000 * index).fadeIn(3000).fadeOut();
});
if(index === 3){
index = 0;
}
}
test();
【问题讨论】:
-
使用 while 循环检查无限循环:stackoverflow.com/questions/24977456/…
标签: javascript jquery