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 xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无缝滚动</title>
    <style type="text/css">
    img{100px;float:left;}
    #content{100px;height:300px;overflow:hidden;}
    .pic01{100px;height:300px;}
    #content #pic img{float:left;}
    </style>
    <script type="text/javascript" src="jquery-1.8.3.min.js"></script>

    </head>
    <body>
    <div id="content">
    <div class="con" style="800px;">

    <div id="pic" class="pic01">
    <img src="1.jpg" alt="" />
    <img src="2.jpg" alt="" />
    <img src="3.jpg" alt="" />
    <img src="4.jpg" alt="" />
    </div>
    <div id="pic1" class="pic01"></div>
    </div>
    </div>
    <script type="text/javascript">
    $(document).ready(function(){
    var speed=20;
    var content=$("#content");
    var pic=$("#pic");
    var pic1=$("#pic1");
    pic1.html(pic.html());
    function marquee(){
    if(content.scrollTop()>=400){
    content.scrollTop(0)

    }else{
    content.scrollTop(content.scrollTop()+1)
    }

    }
    var scroll_ = setInterval(marquee,speed)
    content.mouseover(function(){
    clearInterval(scroll_)
    })
    content.mouseout(function(){
    scroll_ = setInterval(marquee,speed)
    })
    })
    </script>
    </body>
    </html>

    向左滚动:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无缝滚动</title>
    <style type="text/css">
    img{100px;float:left;}
    #content{300px;height:100px;overflow:hidden;}
    .pic01{400px;height:100px;float:left;}
    #content #pic img{float:left;}
    </style>
    <script type="text/javascript" src="jquery-1.8.3.min.js"></script>

    </head>
    <body>
    <div id="content">
    <div class="con" style="800px;">

    <div id="pic" class="pic01">
    <img src="1.jpg" alt="" />
    <img src="2.jpg" alt="" />
    <img src="3.jpg" alt="" />
    <img src="4.jpg" alt="" />
    </div>
    <div id="pic1" class="pic01"></div>
    </div>
    </div>
    <script type="text/javascript">
    $(document).ready(function(){
    var speed=20;
    var content=$("#content");
    var pic=$("#pic");
    var pic1=$("#pic1");
    pic1.html(pic.html());
    function Marquee(){
    if(content.scrollLeft()>=400){
    content.scrollLeft(0);
    }else{
    content.scrollLeft(content.scrollLeft()+1);
    }
    }

    var scroll_ = setInterval(Marquee,speed)
    content.mouseover(function() {
    clearInterval(scroll_);
    } )
    content.mouseout(function() {
    scroll_ = setInterval(Marquee,speed);
    } )
    })
    </script>
    </body>
    </html>

  • 相关阅读:
    python中map函数
    python中的or,and运算符
    输入一个字符串, 返回倒序排列的结果 如: abcdef, 返回 fedcba
    centos7启用iptables
    centos7 shell脚本批量上传文件
    Deployment 中尝试声明一个 Volum
    cpu很高,但是看不到是哪个应用或进程
    从进程角度看docker容器
    02一条update的sql的内部执行流程
    01基础架构,一条SQL查询语句是如何执行的?
  • 原文地址:https://www.cnblogs.com/lixiaoxing/p/5019332.html
Copyright © 2011-2022 走看看