利用jQuery实现表格或者区域内数据的滚动展示效果

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="g-index">
        <div class="right">
            <div >
                <ul id="demo">
                    <li>1111</li>
                    <li>2222</li>
                    <li>3333</li>
                    <li>4444</li>
                    <li>5555</li>
                    <li>6666</li>
                </ul>
            </div>
           
        </div>
</body>
<script src="./js/jquery.min.js"></script>
<script>
    function change() {
        var body=$("#demo");
        body.append(body.children().first());
    }
    $(document).ready(function() {
        $("#demo").mouseenter(function () {
            clearInterval(MyMar1)
        });
        $("#demo").mouseleave(function () {
             MyMar1 = setInterval(change, 1000);
        });
    });

    var MyMar1=setInterval(change,1000);
</script>
</html>

  

posted @ 2023-09-25 22:42  thomas张  阅读(277)  评论(0编辑  收藏  举报