图片闪烁的特效

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);
});

以上是图片隔几秒闪烁然后停止

 

以下图片不停闪烁的特效

方法一:

<DIV ID="soccer">
<img SRC="http://ugc.qpic.cn/baikepic/33866/cut-20140711095236-1914130552.jpg/0" border="0" onload="return imgzoom(this,600);" onclick="javascript:window.open(this.src);" style="cursor:pointer;"/>
</DIV>
<SCRIPT>
var msecs=1000; //改变时间得到不同的闪烁间隔;
var counter=0;
function soccerOnload(){
setTimeout("blink()", msecs)}
function blink(){
soccer.style.visibility=
(soccer.style.visibility=="hidden") ? "visible" : "hidden"
counter+=1;setTimeout("blink()", msecs)}soccerOnload()
</SCRIPT>

 方法二:

<script type="text/javascript">
 function show(){
 var imgid=document.getElementById("imgid");
 if(imgid.style.visibility == "visible")
     imgid.style.visibility = "hidden";
 else
     imgid.style.visibility = "visible";
 setTimeout('show()',300);
  }
  show();
</script>
原文地址:https://www.cnblogs.com/yyy251/p/6836105.html