zoukankan      html  css  js  c++  java
  • js 实现图片透明度变化

    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="utf-8">
            <style>
                #box{ 200px;height: 200px;background-color: #f00;filter:alpha(opacity=30); opacity:0.3;}
            </style>
            <script>
            window.onload = function(){
                    
                var timer =null,
                    oBox = document.getElementById('box'),
                    alpha =30;

                oBox.onmouseover=function(){
                        move(100);
                    }
                    oBox.onmouseout=function(){
                        move(30);
                    }

                function move(target){
                    clearInterval(timer);
                    timer = setInterval(function(){

                        var speed =0;
                        if(alpha>target){
                            speed=-5;

                        }else{
                            speed=5;
                        };

                        if(alpha==target){
                            clearInterval(timer);
                        }else{
                            alpha+=speed;
                            oBox.style.filter = 'alpha(opacity='+alpha+')';
                            oBox.style.opacity = alpha/100;

                        };

                    },30)

                }

            };
            </script>
        </head>
        <body>
            <div id="box"></div>
        </body>
    </html>

  • 相关阅读:
    事务与事务隔离级别
    TNS12535: TNS: 操作超时
    11g的exp导出空表提示EXP00011: SCOTT.TEST1 不存在
    oracle中chr含义
    SQL Server 2008 System Views Map
    SQL Server Execution Plans eBook
    生成建表脚本(V3.0)
    SQL Server 2008 通过配置数据库邮件实现发送邮件功能
    MSSQL2005中的非公开存储过程sp_msdependencies
    SQL Server Tacklebox Free eBook
  • 原文地址:https://www.cnblogs.com/water-wf/p/8574071.html
Copyright © 2011-2022 走看看