• 无缝滚动


    向上滚动:

    <!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>

  • 相关阅读:
    ffmpeg处理视频与声音
    吸引力
    bzoj 2752: [HAOI2012]高速公路(road)
    bzoj 3653 [湖南集训]谈笑风生
    bzoj 3143: [Hnoi2013]游走
    16,docker入门
    15.9,python操作redis集群
    15.8,redis-cluster配置
    15.7,哨兵集群
    15.6,redis主从同步
  • 原文地址:https://www.cnblogs.com/lixiaoxing/p/5019332.html
Copyright © 2020-2023  润新知