当前位置:首页 >> 网络编程

js图片闪动特效可以控制间隔时间如几分钟闪动一下

编辑:jimmy
  日期: 2024/10/8 浏览:1 次

图片一出来,过5秒钟,开始闪动,然后停止。

var inter={};
var i=0;
$(document).ready(function(){
$("a").each(function(index,item){
$(this).bind().click(function(){
i=index;
if(inter!=null || inter.length>0){
window.clearInterval(inter);
}

window.setTimeout(function(){
inter=window.setInterval(function(){ $("img").eq(i).show().fadeOut(100).fadeIn(100);},500);
window.setTimeout(function(){
window.clearInterval(inter);
},5000);
},5000);

});

});
window.setTimeout(function(){
inter=window.setInterval(function(){ $("img").eq(i).show().fadeOut(100).fadeIn(100);},500);
window.setTimeout(function(){
window.clearInterval(inter);
},5000);
},5000);
});
上一篇: JS 排序输出实现table行号自增前端动态生成的tr
下一篇: js使用for循环查询数组中是否存在某个值