zoukankan      html  css  js  c++  java
  • 图片闪烁的特效

    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>
  • 相关阅读:
    关于控制地址控件的代码
    获取某个设计项列表界面上查询框中的值的代码
    js中不同值的替换
    js截取字符串方法实例
    抛异常语句的种类及区别
    从获取结果中去除重复记录
    泛微E8升级E9代码修改
    中控考勤数据转换
    WEB打印,分页首行自动带出栏目标题
    VS附加进程调试IIS网站
  • 原文地址:https://www.cnblogs.com/yyy251/p/6836105.html
Copyright © 2011-2022 走看看