zoukankan      html  css  js  c++  java
  • 网页侧栏小分享

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Examples</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <link href="" rel="stylesheet">
    <style>
        #div1{
            width:200px;height:200px;background: green;position: absolute;left:-200px;
        }
        #div1 span{
            width:20px;height:60px;background: blue;line-height: 20px;position: absolute;right:-20px;top:70px;
        }
    </style>
    <script>
        window.onload=function(){
            var oDiv=document.getElementById('div1');
            oDiv.onmouseover=function(){
                startMove(10,0);
            }
            oDiv.onmouseout=function(){
                startMove(-10,-200);
            }
        }
        var timer=null;
        function startMove(speed,iTarget){
        var oDiv=document.getElementById('div1');
            clearInterval(timer);
            timer=setInterval(function(){
                if(oDiv.offsetLeft==iTarget){
                    clearInterval(timer);
                }else{
                    oDiv.style.left=oDiv.offsetLeft+speed+'px';
                }
            },30)
        }
    </script>
    </head>
    <body>
        <div id="div1">
            <span>分享到</span>
        </div>
    </body>
    </html>
  • 相关阅读:
    dd的用法
    od的用法
    Windows 7安装Oracle 10g的方法
    Ubuntu下的iptux和Windows下的飞秋互传文件
    c++ 12
    c++ 11
    c++ 10
    c++ 09
    c++ 08
    c++ 07
  • 原文地址:https://www.cnblogs.com/itsmart/p/8047681.html
Copyright © 2011-2022 走看看