jquery文字縱向滾動效果(帶間隔停留)


<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>
                <!--滾動文字結束-->

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM