zoukankan      html  css  js  c++  java
  • 文字无缝向上滚动

    代码如下:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>文字无缝向上滚动</title>
    <style type="text/css">
    ul,li{margin:0;padding:0}
    #scrollDiv{width:300px;height:25px;line-height:25px;border:#ccc 1px solid;overflow:hidden}
    #scrollDiv li{height:25px;padding-left:10px;}
    </style>
    <SCRIPT type=text/javascript src="js/jquery.js"></SCRIPT>
    
    <script type="text/javascript">
    var run;
    var scroltime=5000//间隔时间
    function AutoScroll(obj){
            $(obj).find("ul:first").animate({
                    marginTop:"-25px"
            },1000,function(){
                    $(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
            });
    }
    $(document).ready(function(){
    run=setInterval('AutoScroll("#scrollDiv")',scroltime)
    $("#scrollDiv").mouseover(function(){
    clearInterval(run);       
    }); 
    $("#scrollDiv").mouseout(function(){
    run=setInterval('AutoScroll("#scrollDiv")',scroltime)      
    }); 
    });
    </script>
    </head>
    
    <body>
    <div  id="scrollDiv">
    <ul>
        <li>这是公告标题的第一行</li>
        <li>这是公告标题的第二行</li>
        <li>这是公告标题的第三行</li>
        <li>这是公告标题的第四行</li>
        <li>这是公告标题的第五行</li>
        <li>这是公告标题的第六行</li>
        <li>这是公告标题的第七行</li>
        <li>这是公告标题的第八行</li>
    </ul>
    </div>
    
    </body>
    </html>
  • 相关阅读:
    linux 获取外网ip地址
    出现大量rcuob进程
    禁用 ipv6
    centos yum 坏掉 db 损坏
    关于 solusvm
    VMWare 下 Ubuntu 18.04 的文件共享
    安装最新版本 nginx
    大量的Close_wait 发现的 too many open file 错
    Linux安装Desktop 和 vncserver
    MySQL in和limit不能连用的问题
  • 原文地址:https://www.cnblogs.com/webqiand/p/4609607.html
Copyright © 2011-2022 走看看