zoukankan      html  css  js  c++  java
  • 公告栏翻滚显示

    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="UTF-8">
    	<title>Document</title>
    	<script type="text/javascript" src="http://www.w3school.com.cn/jquery/jquery.js"></script>
    	<style type="text/css">
            * {
                margin: 0;
                padding: 0;
            }
            body{font-size: 14px;font-family: "yahei";}
            a {
                text-decoration: none;
            }
            .clearfix{*zoom:1;}
            .clearfix:after,.clearfix:before{display:block; content:"clear"; height:0; clear:both; overflow:hidden; visibility:hidden;}
            .fl{float:left;}
            .fr{float:right;}
            /* 公告 */
            .notice-zb{
                1190px;
                height:60px;
                margin:50px auto;
                background: #f9f9f9;
                line-height: 60px;
                overflow:hidden;
                color:#5e0000;
                font-size: 14px;
            }
            .notice-zb .imgtxt{
                display: inline-block;
                132px;
            }
            .notice-zb img.naba{
                display: inline-block;
                 29px;
                height: 25px;
                margin:0px 12px 0 20px;
            }
            .notice-zb ul{
                height:100%;
                display: inline-block;
                1045px;
                padding-right:8px;
            }
            .notice-zb ul li{
                100%;
                height:100%;
                line-height: 60px;
            }
            .notice-zb ul li a{
                color:#5e0000;
            }
            .notice-zb ul li a:hover{
                /*text-decoration: underline;*/
                color:#d71326;
            }
        </style>
    </head>
    <body>
    <!-- 公告 -->
    <div class="notice-zb ">
        <span class="imgtxt fl"><img class="naba" src="" alt="">公告信息:</span>
        <ul class="fl">
            <li class="clearfix">1.查询模块菜单名称更新公告<a href="" target="_blank" class="fl"></a><span class="fr">2017/01/19</span></li>
            <li class="clearfix">2.新旧名称对照表<a href="" target="_blank" class="fl"></a><span class="fr">2017/01/20</span></li>
            <li class="clearfix">3.新旧名称对照表<a href="" target="_blank" class="fl"></a><span class="fr">2017/01/20</span></li>
        </ul>
    </div>
    <script>
        //公告滚动
        (function(){
            var timer;
            auto();
            function auto(){
                timer = setInterval(function(){
                    var oUl = $('.notice-zb ul');
                    var aLi = oUl.find('li');
                    var oHeight =  aLi.eq(0).height();
                    oUl.animate({'marginTop':-oHeight + 'px'},500,function(){
                        oUl.css('marginTop','0px').find('li:first').appendTo(oUl);
                    });
                },3000);
            }
            $('.notice-zb').mouseenter(function(){
                clearInterval(timer);
            }).mouseleave(function(){
                auto();
            });
        })();
    </script>
    	
    </body>
    </html>
    

    不过这种写法当页面长期打开时,会有bug!  

  • 相关阅读:
    二叉排序树
    堆排序
    线索化二叉树
    vue 格式化代码
    线程的理解
    声明式的服务调用 Feign
    使用锁 的理解
    zookeeper 的理解
    AQS 源码解析
    HashMap 的理解与结构
  • 原文地址:https://www.cnblogs.com/mmzuo-798/p/6738782.html
Copyright © 2011-2022 走看看