zoukankan      html  css  js  c++  java
  • FireFox,IE下图片渐变示例

    <img src="13_dp.gif" name="TestImg" width="87" height="87" border="0" id="TestImg" style="0px;overflow:hidden;position:absolute;top:0px;filter:alpha(opacity=30);moz-opacity: 0.3;" title="渐变" onmouseover="addOpacity(this,5,30,100);" />

    <script language="javascript">

    var IE=!!(window.attachEvent && !window.opera);

    var Opera=!!window.opera;

    //设置图片透明度

        function setOpacity(id,value)

        {

           if(IE || Opera) {

                id.filters.alpha.opacity = value*100;

           }else

            {

               id.style.MozOpacity = value;

               id.style.Opacity = value;

           }

       }

        

        //透明度间变

        //id:目标引用,step:变化步长可为正或负,currentValue:当前值,targetValue:目标值

        function addOpacity(id,step,currentValue,targetValue)

        {

           if(step <0 && currentValue<=targetValue || step >0 && currentValue >= targetValue)

               return;

          currentValue = currentValue + step;

           setOpacity(id,currentValue/100);

           setTimeout(function(){addOpacity(id,step,currentValue,targetValue);},

               50);

        }

    </script>

  • 相关阅读:
    web api 设置允许跨域,并设置预检请求时间
    T4模板
    DDD模式
    Vue watch用法
    第三章--第五节:集合
    简单的Python API爬虫与数据分析教程--目录
    第三章--第四节:字典
    第三章--第三节(补充):列表排序
    汇总张小龙在知乎上的问答
    第三章--第三节:列表
  • 原文地址:https://www.cnblogs.com/top5/p/1542582.html
Copyright © 2011-2022 走看看