zoukankan      html  css  js  c++  java
  • jQuery轮播图的事项 代码详细,容易理解。。。。谢谢观赏

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title></title>
    <style type="text/css">
    *{margin: 0;padding: 0;list-style: none;}
    .container{height: 600px; 600px;margin: 100px auto;position: relative;overflow: hidden;}
    .container ul li{position: relative;}
    .container ul li a{600px;height: 600px;}
    img{600px;height: 600px;float: left;}
    .container ul li a{display: block;}
    .container ul li p{position: absolute; 100%;padding: 10px 0;background: rgba(0,0,0,.6);bottom:0;left: 0;text-indent: 2em;font-size: 18px;display: none;z-index: 9999;}
    .container .current p {display: block;}
    .arrow{display: none;}
    .container:hover .arrow{display: block;}
    .arrow:hover {background-color: rgba(0, 0, 0, .5);}
    .arrow-left,.arrow-right{ 30px; height: 60px;background-color: rgba(0, 0, 0, 0.1); position: absolute;top: 50%; cursor: pointer;text-align: center;line-height: 60px;}
    .arrow-left {left: 0;}
    .arrow-right {right: 0;}
    </style>
    </head>
    <body>
    <div class="container">
    <ul>
    <li><a><img src="../si/1.jpg" ><p>11111111111111111111111111111</p></a></li>
    <li><a><img src="../si/12.jpg" ><p>22222222222222222222222222222</p></a></li>
    <li><a><img src="../si/13.jpg" ><p>3333333333333333333333333333</p></a></li>
    <li><a><img src="../si/14.jpg" ><p>444444444444444444444444444444</p></a></li>
    <li><a><img src="../si/15.jpg" ><p>555555555555555555555555555555</p></a></li>
    </ul>
    <div class="arrow">
    <span class="arrow-left">&lt;</span>
    <span class="arrow-right">&gt;</span>
    </div>
    </div>
    </body>
    <script src="jQuery/jquery-2.2.4.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
    var index = 0;
    $(".container>ul>li").eq(index).fadeIn(0).addClass("current").siblings().fadeOut()
    $(".arrow-right").click(function(){
    index++
    console.log(index)
    if(index == $(".container>ul>li").length){
    index = 0
    }
    $(".container>ul>li").eq(index).fadeIn(0).addClass("current").siblings().fadeOut()
    })
    $(".arrow-left").click(function(){
    index--
    if(index < 0){
    index = $(".container>ul>li").length-1
    }
    $(".container>ul>li").eq(index).fadeIn(0).addClass("current").siblings().fadeOut()
    })
    var time = setInterval(function(){$(".arrow-right").click()},2000)
    $(".container").mouseenter(function(){clearInterval(time)})
    $(".container").mouseleave(function(){
    time = setInterval(function(){$(".arrow-right").click()},2000)
    })



    </script>
    </html>

  • 相关阅读:
    Linux .o a .so .la .lo的区别
    linux源码Makefile详解
    Kconfig详解
    如何将驱动程序静态编译进内核
    getpeername
    Socket programming in C on Linux | tutorial
    C Socket Programming for Linux with a Server and Client Example Code
    UDP protocol
    TCP protocol
    How to learn linux device driver
  • 原文地址:https://www.cnblogs.com/CH-cnblogs/p/13526801.html
Copyright © 2011-2022 走看看