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>
  • 相关阅读:
    目录:数据挖掘
    目录:工具的安装与激活
    目录:Django框架开发Web系统的功能实现过程
    Python3.5在jupyter中使用graphviz画决策树(包括graphviz-2.38.msi的安装)
    2020年全国高校计算机能力挑战赛Python程序设计初赛
    离群异常值与重复数据检测
    数据描述性统计度量方法
    数据挖掘的方法
    Nginx+uWSGI+Django部署方案的详细实现过程
    VMware的联网配置及虚拟机IP配置
  • 原文地址:https://www.cnblogs.com/tis100204/p/10328772.html
Copyright © 2011-2022 走看看