• js笔记----(运动)分享 隐藏/显示


    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title></title>
        <style>
            body, div { padding:0px; margin:0px; }
            #box{ height:300px; 200px; background-color:#ccc; position:absolute;left:-200px; margin-top:200px;border:1px solid #ffd800; border-radius:6px;}
            #box span{ height:85px; 40px; position:absolute;left:200px; top:103px; line-height:40px; font-size:20px; background-color:yellow; font-weight:bold; text-align:center; border-radius:6px; border:1px solid #ffd800;}
        </style>
        <script type="text/javascript">
            window.onload = function () {
                var oDiv = document.getElementById('box');
                oDiv.onmouseover = function () {
                    StarMove(0);
                }
                oDiv.onmouseout = function () {
                    StarMove(-200);
                }
            }
            var timer = null;
            function StarMove(Targer)
            {
                var iSpeed = 0;
                var oDiv = document.getElementById('box');
                clearInterval(timer);
                if (oDiv.offsetLeft < Targer) {
                    iSpeed = 10;
                } else {
                    iSpeed = -10;
                }
    
                timer = setInterval(function () {
                    if (oDiv.offsetLeft == Targer) {
                        clearInterval(timer);
                    }
                    else {
                            oDiv.style.left = oDiv.offsetLeft + iSpeed + 'px';
                    }
                    
                }, 30);
            }
        </script>
    </head>
    <body>
        <div id="box">
            <span>分享</span>
        </div>
    </body>
    </html>
  • 相关阅读:
    java native方法
    linux free命令
    gdb使用
    java锁——wait,notify,synchronized
    java面试——问题回溯
    (转)每天一个linux命令(44):top命令
    java面试——jvm
    java面试——多线程
    数据库面试总结
    CMakeLists.txt使用
  • 原文地址:https://www.cnblogs.com/juexin/p/4056420.html
Copyright © 2020-2023  润新知