zoukankan      html  css  js  c++  java
  • 无缝滚动 js 一

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
    <html>
    <head>
    <style>
    body{height:10000px; background:#ccc;}
    #gg_left, #gg_right{
    position: fixed;
    }
    #gg_left{120px;height:240px;top:230px;left:0;}
    #gg_right{120px;height:240px;top:230px;right:0;}
    </style>
    <!--[if lte IE 6]>
    <style type="text/css">

    #gg_left, #gg_right{
    position: absolute;
    }
    </style>
    <![endif]-->

    </head>
    <body>

    <div id="gg_left"><embed src="C:UsersloveDesktop320.swf" width="120px;" height="240px;"></div>
    <div id="gg_right"><embed src="C:UsersloveDesktop320.swf" width="120px;" height="240px;"></div>

    <div id="tickerContainer" style="400px;margin:10px auto;">
    <div id="ticker">
    <ul id="demo">edk;cwscdweqweqwdqw</ul>
    <ul id="demo">234545qw565656dqw</ul>
    <ul id="demo">0fdkfFEP2edk;cwscdweqweqwdqw</ul>
    <ul id="demo">0--=-kokfedk;cwscdweqweqwdqw</ul>

    </div>
    </div>

    <script type="text/javascript" src="xxx/jquery.js"></script>(可到网上搜索,或直接用网上的路径,如google的)
    <script type="text/javascript">
    $(function() {

    //cache the ticker
    var ticker = $("#ticker");

    //wrap dt:dd pairs in divs
    ticker.children().filter("demo").each(function() {

    var dt = $(this),
    container = $("<div>");

    dt.next().appendTo(container);
    dt.prependTo(container);

    container.appendTo(ticker);
    });

    //hide the scrollbar
    ticker.css("overflow", "hidden");

    //animator function
    function animator(currentItem) {

    //work out new anim duration
    var distance = currentItem.height();
    duration = (distance + parseInt(currentItem.css("marginTop"))) / 0.025;

    //animate the first child of the ticker
    currentItem.animate({ marginTop: -distance }, duration, "linear", function() {

    //move current item to the bottom
    currentItem.appendTo(currentItem.parent()).css("marginTop", 0);

    //recurse
    animator(currentItem.parent().children(":first"));
    });
    };

    //start the ticker
    animator(ticker.children(":first"));

    //set mouseenter
    ticker.mouseenter(function() {

    //stop current animation
    ticker.children().stop();

    });

    //set mouseleave
    ticker.mouseleave(function() {

    //resume animation
    animator(ticker.children(":first"));

    });
    });
    </script>

    </body>
    </html>

  • 相关阅读:
    [转] 传统 Ajax 已死,Fetch 永生
    React组件属性部类(propTypes)校验
    [转]webpack进阶构建项目(一)
    package.json 字段全解析
    [转]Nodejs基础中间件Connect
    [转]passport.js学习笔记
    [转]Travis Ci的最接底气的中文使用教程
    建站笔记1:centos6.5下安装mysql
    [软件人生]关于认知,能力的思考——中国城市里的无知现象片段
    一步一步学Spring.NET——1、Spring.NET环境准备
  • 原文地址:https://www.cnblogs.com/zhicheng/p/3183680.html
Copyright © 2011-2022 走看看