<script type="text/javascript">
//文字纵向滚动
$(function() { 
    var $this = $("#quotation"); 
    var scrollTimer;
    
    $this.hover(function() { 
        clearInterval(scrollTimer); 
        }, function() { 
        scrollTimer = setInterval(function() { 
        scrollNews($this); 
        },3000); 
    }).trigger("mouseleave"); 
    
    function scrollNews(obj) { 
        var $self = obj.find("ul"); 
        var lineHeight = $self.find("li:first").height(); 
        $self.animate({ 
        "marginTop": -lineHeight + "px" 
        },500, function() { 
        $self.css({ 
        marginTop: 0 
        }).find("li:first").appendTo($self); 
        }) 
    } 
}) 

</script>

以下是HTML代码

<!--滚动文字开始-->
                <div id="quotation" style="height:17px; line-height:17px; overflow:hidden; margin-top:15px;  ">
                    <ul style="margin:0;padding:0; list-style:none">
                        <li style="display: list-item;">1111111111</li>
                       <li style="display: list-item;">2222222</li>
                        <li style="display: list-item;">3333333333333</li>
                    </ul>
                </div>
                <!--滚动文字结束-->

 

转载于:https://www.cnblogs.com/kingfly/p/4042442.html

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐