• 滑动效果


    滑动效果:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <style type="text/css">
    *{margin:0px auto; padding:0px;}
    #wai{ 1000px; height:500px; margin-top:30px;}
    #left{ height:500px; background-color:#F00; float:left}
    #right{height:500px; background-color:#0F0; float:left}
    #btn{ 50px; height:50px; background-color:#00F; position:relative; margin-left:0px; top:225px; }
    </style>
    </head>
    
    <body>
    
    <div id="wai">
        <div id="left" style="200px;"></div>
        <div id="right" style=" 800px; "></div>
        <div id="btn" style="left:175px;"></div>
    </div>
    
    </body>
    </html>
    <script type="text/javascript">
    var btn = document.getElementById("btn");
    var st;
    btn.onclick = function()
    {
        st = window.setInterval("jia()",10)
        
        }
    function jia()
    {
        var left = document.getElementById("left");
        var right = document.getElementById("right");
        var btn = document.getElementById("btn");
        var rwidth = parseInt(right.style.width);
        var lwidth = parseInt(left.style.width);
        var lbtn = parseInt(btn.style.left);
        if(lwidth<1000){
            lwidth++;
            rwidth--;
            lbtn++;
            btn.style.left=lbtn+"px";
            left.style.width=lwidth+"px";
            right.style.width=rwidth+"px";
            }else{ window.clearInterval(st);}
        }
    </script>

    效果图:

  • 相关阅读:
    KBEngine源码:EntityCall
    skynet 学习笔记-sproto模块(2)
    mongodb:为什么用mongodb
    编写高效服务器程序,需要考虑的因素
    b+树
    mysql:架构
    超越函数/微分方程 /积分中的技术/级数
    积分从入门到放弃<2>
    PyQt4 / PyQt5
    图形学算法:
  • 原文地址:https://www.cnblogs.com/Whitehat/p/8125459.html
Copyright © 2020-2023  润新知