前端开发间歇性滚动

前端和安卓开发工具
新手用的前端开发工具
linux环境前端开发工具

html 代码

<!DOCTYPE html>
    <head>
        <meta charset=”UTF-8″ />
        <title></title>
        <style type=”text/css”>
            #main {
                width: 500px;
                height: 72px;
                overflow: hidden;
                border: 1px solid #ddd;
            }
            #uli {
                list-style: none;
                margin: 0;
            }
            #uli li {
                height: 24px;
                line-height: 24px;
            }
            #uli li a {
                text-decoration: none;
                color: #000;
            }
            #uli li a:hover {
                color: red;
            }
        </style>
    </head>
    <body>
        <div id=”main”>
            <ul id=”uli”>
                <li>
                    <a href=”#”>1、必应词典(Bing Dictionary)</a>
                </li>
                <li>
                    <a href=”#”>2、必应词典(Bing Dictionary)是微软推出的</a>
                </li>
                <li>
                    <a href=”#”
                        >3、必应词典(Bing Dictionary)是微软推出的新一代</a
                    >
                </li>
                <li>
                    <a href=”#”>4、为您提供优质的免费词典和翻译服务。</a>
                </li>
                <li>
                    <a href=”#”>5、优质的免费词典和翻译服务。</a>
                </li>
                <li>
                    <a href=”#”
                        >6、必应词典为您提供优质的免费词典和翻译服务。</a
                    >
                </li>
            </ul>
        </div>
    </body>
    <script>
        var uli = document.getElementById(‘main’)
        var iliHeight = 24
        var timer
        uli.innerHTML += uli.innerHTML
        uli.scrollTop = 0
        function startMove() {
            uli.scrollTop++
            timer = setInterval(‘scrollUp()’, 50)
        }
        function scrollUp() {
            if (uli.scrollTop % iliHeight == 0) {
                clearInterval(timer)
                setTimeout(‘startMove()’, 2000)
            } else {
                uli.scrollTop++
                if (uli.scrollTop >= uli.scrollHeight / 2) {
                    uli.scrollTop = 0
                }
            }
        }
        setTimeout(‘startMove()’, 2000)
    </script>
</html>
程序前端开发工具
前端架构 前端开发工具
简易前端开发工具
» 本文来自:前端开发者 » 《前端开发间歇性滚动》
» 本文链接地址:https://www.rokub.com/8108.html
» 您也可以订阅本站:https://www.rokub.com
赞(0)
64K

评论 抢沙发

评论前必须登录!