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>

  • 相关阅读:
    关于动态的添加iview admin路由以及刷新侧边栏按钮
    Qt配置,载入html,Echart, 交互
    junit、hamcrest和eclemma安装、使用
    程序中关于浮点数计算的问题
    洛谷P1164->小A点菜
    一道简单的题目
    P1101:单词方阵
    第一个博客
    php生成条形码
    php 上传音频(MP3、MP4等)文件 获取播放时间长度
  • 原文地址:https://www.cnblogs.com/lixiaoxing/p/5019332.html
Copyright © 2011-2022 走看看