zoukankan      html  css  js  c++  java
  • 匀速展开(侧边分享的效果)

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
        </head>
        <style>
            *{
                margin: 0;
                padding: 0;
            }
            div{
                100px;
                height: 200px;
                background: red;
                position: relative;
                top:300px;
                left:-100px;
            }
            span{
                30px;
                height: 80px;
                position: absolute;
                left: 100px;
                top:60px;
                border:1px solid black;
                text-align: center;
                line-height: 25px;
                
            }
        </style>
        <body>
            <div><span>分享到</span></div>
        </body>
    </html>

    <script>
         var oDiv = document.querySelector("div");
         var timer = null;
         oDiv.onmouseover = function(){
            startMove( 0 );
         }
         oDiv.onmouseout = function(){
            startMove( -100 );
         }
        
         function startMove(target){
            clearInterval( timer );
            timer = setInterval( function(){
                var speed = target - oDiv.offsetLeft>0 ? 5 : -5;
                if( oDiv.offsetLeft === target ){
                    clearInterval( timer );
                }else{
                    oDiv.style.left = oDiv.offsetLeft + speed + "px";
                }
            },30 )
        }
    </script>
  • 相关阅读:
    Coxph model Pvalue Select2
    Coxph model Pvalue Select
    WGCNA 分析
    Python 识别验证码
    Python2.X如何将Unicode中文字符串转换成 string字符串
    客户端putty xshell连接linux中vim不能正常使用小键盘的问题
    解决Selenium Webdriver执行测试时,每个测试方法都打开一个浏览器窗口的问题
    在Windows上,迁移VisualSVN server
    testNG设置测试的执行顺序
    重新加载maven项目的依赖项
  • 原文地址:https://www.cnblogs.com/tis100204/p/10328772.html
Copyright © 2011-2022 走看看