• Javascript做图片无缝平滑滚动


    因需要,google得到。作者不详。多谢。我这里略作修改。只是改变了ID。

    <!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"> 
    body,html,div,a{ margin:0 auto; padding:0} 
    #scroll_top {background: #FFF; overflow:hidden; border: 1px dashed #CCC; width: 98%; } 
    #scroll_top img {border: 3px solid #F2F2F2; } 
    #scroll_main {float: left; width: 800%; } 
    #scroll1 {float: left; } 
    #scrol2 { float: left; margin-left:7px; } 
    </style> 
    <script type="text/javascript"> 
    window.onload = function(){ 
    var speed=50;var tab=document.getElementById("scroll_top"); 
    var tab1=document.getElementById("scroll1"); 
    var tab2=document.getElementById("scrol2"); 
    tab2.innerHTML=tab1.innerHTML; 
    function Marquee(){ 
    if(tab2.offsetWidth-tab.scrollLeft<=0) 
    tab.scrollLeft-=tab1.offsetWidth 
    else{ 
    tab.scrollLeft++; 
    } 
    } 
    var MyMar=setInterval(Marquee,speed); 
    tab.onmouseover=function() {clearInterval(MyMar)}; 
    tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)}; 
    } 
    </script> 
    </head> 
    <body> 
     
    <div id="scroll_top"> 
    <div id="scroll_main"> 
    <div id="scroll1"> 
    <img src="http://www.google.com/images/errors/robot.png" alt="404" />
    <img src="http://www.google.com/images/errors/robot.png" alt="404" />
    <img src="http://www.google.com/images/errors/robot.png" alt="404" />
    <img src="http://www.google.com/images/errors/robot.png" alt="404" />
    <img src="http://www.google.com/images/errors/robot.png" alt="404" />
    <img src="http://www.google.com/images/errors/robot.png" alt="404" />
    <img src="http://www.google.com/images/errors/robot.png" alt="404" />
    </div> 
    <div id="scrol2" ></div> 
    </div> 
    </div> 
    </body> 
    </html>

    特来收藏。

    Live Like You're Dying And Never Stop Tying
  • 相关阅读:
    HTML初识
    使用python操作Memcache、Redis、RabbitMQ、
    使用salt-cloud创建虚拟机
    运维堡垒机----Gateone
    ELK日志分析系统
    Python MySQL API
    浅谈Java中static作用--转
    oracle如何设置最大连接数
    转--oracle查看允许的最大连接数和当前连接数等信息
    oracle 查看未关闭连接
  • 原文地址:https://www.cnblogs.com/dying/p/3213862.html
Copyright © 2020-2023  润新知