zoukankan      html  css  js  c++  java
  • JS_间歇滚动_加入运动框架

    <!DOCTYPE HTML>
    <html>
    <head>
      <meta http-equiv="content-type" charset="utf-8" />
        <meta http-equiv="content-type" content="text/html" />
        <title>demo</title>
    </head>
    <style type="text/css">
    *{margin:0;padding:0;}
    ul,li,img{margin:0;padding:0;border:0;list-style-type:none;}
    #luanbo{border:1px solid red;overflow:hidden;height:24px;}
    #info li{height:24px;line-height:24px;}
    </style>
    <body>
        <div id="luanbo">
           <ul id="info">
            <li>aaaaaaaaaaa</li>
            <li>bbbbbbbbbbb</li>
            <li>ccccccccccc</li>
            <li>ddddddddddd</li>
            <li>eeeeeeeeeee</li>
            <li>fffffffffff</li>
           </ul>
        </div>
    
    
    <script type="text/javascript">
    var odiv=document.getElementById("luanbo");
    var oul=document.getElementById("info");
    var oli=document.getElementById("info").getElementsByTagName("li");
    var iNow=0;
    function move(obj,tg){     //运动框架
    clearInterval(dt);
    var dt=setInterval(function(){
        var speed=2;
        if(tg-obj.scrollTop<speed){
            tg=obj.scrollTop;
            clearInterval(dt);
        }else{
            obj.scrollTop+=speed;
        }
    },30);    
    }
    oul.innerHTML+=oul.innerHTML;
    function star(){
    clearInterval(tm);
    var tm=setInterval(function(){
        iNow++;
        if(odiv.scrollTop>=(oli[0].offsetHeight*oli.length)/2){
            odiv.scrollTop=0;
            iNow=0;
        }else{
        var get=oli[0].offsetHeight*iNow;
        move(odiv,get);                     //运动框架
        }
    },2000); 
    }
    star();
    
    </script>
    </body>
    </html>
  • 相关阅读:
    【MM 】采购合同成批维护
    【FICO 汇率】汇率
    【S4 MM】S4中继续使用MB系统事务代码(转)
    【MM 交货成本】Unplanned Delivery Cost
    Tracer Deployment UVALive
    The Best Path HDU
    Artwork Gym
    PTA 银行排队问题之单队列多窗口加VIP服务 队列+模拟
    Counting Cliques HDU
    Do not pour out HDU
  • 原文地址:https://www.cnblogs.com/hcjs/p/2637484.html
Copyright © 2011-2022 走看看