• 轮播图


    <!DOCTYPE HTML>
    <html>
    <head>
      <meta http-equiv="content-type" charset="utf-8" />
        <meta http-equiv="content-type" content="text/html" />
        <title>demo</title>
    </head>
    <style type="text/css">
    *{margin:0;padding:0;}
    ul,li,img{margin:0;padding:0;border:0;list-style-type:none;}
    #list{height:250px;list-style-type:none;overflow:hidden;}
    #luanpo{max-600px;height:200px;border:1px solid #CCC;margin:0 auto;position:relative;overflow:hidden;}

    #imgs li{float:left;height:200px;600px;}
    #imgs li img{height: 200px; 600px;}
    #imgs{height:200px;background:#ddd;position:absolute;}
    .a{background:red;}
    .b{background:yellow;}

    #num{overflow:auto;position:absolute;right:40%;bottom:0;}
    #num li{float:left;height:30px;30px;text-align:center;line-height:30px;border:1px solid ;border-radius: 15px;margin-left:10px;cursor:pointer;z-index:2222;}
    </style>
    <body>
        <div id="luanpo">
            <ul id="imgs">
                <li><img src="image/P1_bg.jpg"></li>
                <li><img src="image/P2_bg.jpg"></li>
                <li><img src="image/P3_bg.jpg"></li>
                <li><img src="image/P1_bg.jpg"></li>
            </ul>
            <ul id="num">
                <li class="a">1</li>
                <li class="b">2</li>
                <li class="b">3</li>
                <li class="b">4</li>
            </ul>
        
        </div>


    <script type="text/javascript">
    var imgs=document.getElementById('imgs').getElementsByTagName('li');
    var nums=document.getElementById("num").getElementsByTagName("li");
    var luanpo=document.getElementById("luanpo");
    var oimg=document.getElementById('imgs');
    var iNow=0;
    var dt=null;
    oimg.style.width=imgs.length*imgs[0].offsetWidth+"px";

    function tab(){
    for(var i=0;i<nums.length;i++){
        nums[i].index=i;
        nums[i].onmousemove=function(){
            clearInterval(dt);
            iNow=this.index;
            for(var i=0;i<nums.length;i++){
                nums[i].className="b";        
            }
            this.className="a";
            oimg.style.left=-(imgs[0].offsetWidth*iNow)+"px";    //这边可以加上我前面所写的那个缓动框架            
        }
        nums[i].onmouseout=function(){
                start();
        }
    }
    }

    function start(){
      clearInterval(dt);
        dt=setInterval(function(){
            if(iNow>nums.length-2){
            iNow=0;
            }else{
            iNow++;
            }
            for(var k=0;k<nums.length;k++){
                if(iNow==nums[k].index){nums[k].className='a';}else{nums[k].className='b';}
            }
            oimg.style.left=-(imgs[0].offsetWidth*iNow)+"px";    //这边可以加上我前面所写的那个缓动框架
        },3000);
        tab();
    }

    start();



    </script>
    </body>
    </html>

  • 相关阅读:
    Spring+MyBatis纯注解零XML整合(4)
    spring boot-mybatis全注解化(3)
    SpringBoot使用Mybatis注解进行一对多和多对多查询(2)
    Spring Boot中使用MyBatis注解配置详解(1)
    mysql 俩个时间相减后取分钟
    mysql加减时间-函数-时间加减
    十种常见排序算法(转)
    开源VS商用,IBM区块链从Hyperledger到商用平台之道 | 对话IBM高级架构师【 笔记】(转)
    java中正则表达式基本用法(转)
    《数学之美》——维特比和他维特比算法
  • 原文地址:https://www.cnblogs.com/qq928252089/p/5094763.html
Copyright © 2020-2023  润新知