1. 程式人生 > >圖片隔幾秒閃爍然後停止的特效

圖片隔幾秒閃爍然後停止的特效

ron src bin epic jpg out window win interval

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>

圖片隔幾秒閃爍然後停止的特效