javascript技巧

关注公众号 jb51net

关闭
首页 > 网络编程 > JavaScript > javascript技巧 > 图片闪动

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

投稿:whsnow

这篇文章主要介绍一个图片闪动特效,可以控制间隔时间如几分钟闪动一下,需要的朋友不要错过

图片一出来,过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);
});
您可能感兴趣的文章:
阅读全文