很多文字在页面一个固定的位置显示,不是一次全部显示,就是像led屏幕上的广告那样。

解决方案 »

  1.   

    用jquery中的infiniteCarousel这个插件
      

  2.   

    看看是不是你想要的<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>test</title>
    <script language="javascript" type="text/javascript">
        var scrollFun = function () {
            var box = document.getElementById("box");
            var con = document.getElementById("con");
            var boxWidth = box.offsetWidth;
            var conWidth = con.offsetWidth;
            var left = +con.style.left.replace("px", "");
            if (left >= boxWidth) {
                con.style.left = -conWidth + "px";
                left = -conWidth;
            }
            con.style.left = (left + 2) + "px";
            setTimeout(scrollFun, 100);    };
        window.onload = scrollFun;
    </script>
    <style type="text/css">
        .box{ border:1px solid red; width:200px; height:50px; position:relative; overflow:hidden;}
        .con{ position:absolute; top:20px; white-space:nowrap;}
    </style>
    </head><body>
    <div id="box" class="box">
        <div id="con" class="con" style="left:0px;">我在滚动</div>
    </div>
    </body>
    </html>