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://w w w .w 3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>焦点图1</title>
    <script type="text/javascript" src="https://code.jquery.com/jquery.js"></script>
    <style type="text/css">*{margin:0; padding:0; list-style:none;}
    .clear-fix{*zoom:1;}
    .clear-fix:after{ content:"020"; clear:both; height:0; display:block;}
    h1{ text-align:center;}
    .slider{980px; height:365px; margin:0 auto; position:relative;}
    .slider .img_box{980px; height:365px; overflow :hidden;}
    .slider ul{100000px;}
    .slider li{ 980px; height:365px; float:left; background:#ccc; text-align:center; font-size:larger; line-height:365px;}
    .slider .num_box{ position:absolute; bottom:10px; right:10px;}
    .slider .num_box a{ 10px; height:10px; background:#fff; border-radius:5px; display:inline-block;}
    .slider .num_box a.c{ background:#C00;}</style>
    </head>
    <body>
    <h1>鼠标点击圆点切换</h1>
    <div class="slider">
    <div class="img_box">
    <ul class="clear-fix">
    <li><a href="javascript:void(0)"><img src="http://h.hiphotos.baidu.com/image/pic/item/14ce36d3d539b60045c4e0b6eb50352ac65cb7ad.jpg"></a></li>
    <li><a href="javascript:void(0)"><img src="http://e.hiphotos.baidu.com/image/pic/item/c75c10385343fbf2464efe26b27eca8065388f51.jpg"></a></li>
    <li><a href="javascript:void(0)"><img src="http://a.hiphotos.baidu.com/image/pic/item/3801213fb80e7bec64b37beb2d2eb9389b506b4a.jpg"></a></li>
    <li><a href="javascript:void(0)"><img src="http://a.hiphotos.baidu.com/image/pic/item/8d5494eef01f3a295552fc0f9b25bc315d607c5c.jpg"></a></li>
    <li><a href="javascript:void(0)"><img src="http://a.hiphotos.baidu.com/image/pic/item/a5c27d1ed21b0ef42b510fe6dfc451da80cb3ec8.jpg"></a></li>
    </ul>
    </div>
    <div class="num_box">
    <a href="javascript:void(0)" class="c"></a>
    <a href="javascript:void(0)"></a>
    <a href="javascript:void(0)"></a>
    <a href="javascript:void(0)"></a>
    <a href="javascript:void(0)"></a>
    </div>
    </div>
    <script type="text/javascript">
    var n=0;
    function slider(n){
        $("ul").animate({marginLeft:-n*980},500);
        $(".num_box a").removeClass("c").eq(n).addClass("c");
    }
    t=setInterval(function(){
        n++;
        n=n>=$(".num_box a").length?0:n;
        slider(n);
        },3000)
    slider(n);
    $(".num_box a").click(function(){
        clearInterval(t);
        slider($(this).index());
        $(".num_box a").mouseout(function(){
            clearInterval(t);
            t=setInterval(function(){
                n=$(".num_box a.c").index()+1;
                n=n>=$(".num_box a").length?0:n;
                slider(n)
            },3000);
        })
    })
    </script>
    </body>
    </html>

  • 相关阅读:
    bzoj1257 [CQOI2007]余数之和sum
    bzoj1053 [HAOI2007]反素数ant
    bzoj3680 吊打XXX
    CodeVS1344 线型网络
    bzoj1925 [Sdoi2010]地精部落
    2016年北大高代考研题解答
    巴塞尔问题(Basel problem)的多种解法
    积分计算题
    PDF添加水印的办法
    Matlab技巧1:在同一坐标系上绘制两个函数图像
  • 原文地址:https://www.cnblogs.com/maxiaodan/p/4754946.html
Copyright © 2011-2022 走看看