草稿

<!DOCTYPE html>

 

<html lang="en">

 

<head>

 

    <meta charset="UTF-8">

 

    <title>自动轮播 Jquery</title>

 

    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">

    </script>

 

    <script>

 

    $(function () {

 

 

        //动态添加数字浮标

 

        var imgNum = $(".img li").size();

 

        for (var i = 1; i <= imgNum; i++) {

            $(".num").append("<li>" + i + "</li>");

 

        }

 

 

 

        $(".img li").eq(0).fadeIn(300);

 

        $(".num li").eq(0).addClass("active");

 

 

 

        //数字浮标的焦点事件

 

        $(".num li").mousemove(function () {

            if (!$(this).hasClass("active")) {

                $(this).addClass("active").siblings().removeClass("active");

 

                idx = $(this).index();

 

                $(".img li").eq(idx).stop().fadeIn(300).siblings().stop().fadeOut(300);

 

            }

 

        });

 

 

 

        //显示向左移动图标

 

        $(".shade_left").hover(function () {

            $(".out .left").stop().fadeIn();

 

        }, function () {

            $(".out .left").stop().fadeOut();

 

        });

 

 

 

        //显示向右移动图标

 

        $(".shade_right").hover(function () {

            $(".out .right").stop().fadeIn();

 

        }, function () {

            $(".out .right").stop().fadeOut();

 

        });

 

 

 

        //转移图片的a标签的click事件

 

        $(".shade").click(function () {

            location.href = $(".img li:visible a").attr("href");

 

        });

 

 

 

        //手动向左移动

 

        $(".out .btn.left").click(function (e) {

            move(-1);

 

            e.stopPropagation();

 

        });

 

        //手动向右移动

 

        $(".out .btn.right").click(function (e) {

            move();

 

            e.stopPropagation();

 

        });

 

 

 

        //自动轮播

 

        var idx = 0;

 

        var timer = setInterval(move, 1000);

 

        function move(left) {

            if (left) { //向左移动

 

                idx--;

 

                if (idx == -1) {

                    idx = imgNum - 1;

 

                }

 

            } else {

                idx++;

 

                if (idx == imgNum) {

                    idx = 0;

 

                }

 

            }

 

            $(".num li").eq(idx).addClass("active").siblings().removeClass("active");

 

            $(".img li").eq(idx).stop().fadeIn(300).siblings().stop().fadeOut(300);

 

        }

 

 

 

        //图片获取焦点时,停止自动轮播

 

        $(".out").hover(function () {

            clearInterval(timer);

 

        }, function () {

            timer = setInterval(move, 1000);

 

        });

 

    });

 

 

 

    </script>

<link type="text/css" rel="stylesheet" data-webporiginal="https://xyq.res.netease.com/pc/gw/20170118103441/pkg/index_53a7dba.css" data-webpnew="https://xyq.res.netease.com/pc/gw/20170118103441/pkg/index_53a7dba_webp.css" href="https://xyq.res.netease.com/pc/gw/20170118103441/pkg/index_53a7dba.css"><style>.webp-hack{display: none;}</style><script>!function(){function e(e,t){for(var i=t.length;i--;)!t[i].getAttribute(e)&&t[i].getAttribute(n)&&t[i].setAttribute(e,t[i].getAttribute(n))}function t(e){if(!(i.push(e)>1))if(o.addEventListener)o.addEventListener("DOMContentLoaded",function(){o.removeEventListener("DOMContentLoaded",arguments.callee,!1),e()},!1);else if(o.attachEvent){var t=!1;try{t=null==window.frameElement}catch(e){}o.documentElement.doScroll&&t&&function(){try{o.documentElement.doScroll("left"),e()}catch(e){setTimeout(arguments.callee,0)}}()}}var n,i=[],o=document;!function(e){var t=new Image;t.οnlοad=function(){var n=t.width>0&&t.height>0;window.__isWebp=!0,e(n)},t.οnerrοr=function(){window.__isWebp=!1,e(!1)},t.src="https://img-blog.csdnimg.cn/2022010709400289647.webp"}(function(i){n=i?"data-webpNew":"data-webpOriginal",e("href",document.getElementsByTagName("link")),t(function(){e("src",document.getElementsByTagName("img")),e("href",document.getElementsByTagName("link"))})})}();</script><style type="text/css" abt="234"></style>

    <style>

 

        /* * {

            padding: 0;

 

            margin: 0;

 

        }

 

        @media (min-width: 1200px) {

            .out {

                width: 1140px;

            }

        }

        @media (min-width: 992px) {

            .out {

                width: 970px;

            }

        }

        @media (min-width: 768px){

            .out {

                width: 750px;

            }

        }

        img {

            width: 800px;

 

            height: 600px;

 

        }

 

        ul li {

            list-style: none;

 

        }

 

        .out {

            margin: 50px auto;

 

            width: 800px; 

 

            height: 600px;

 

            position: relative;

 

        }

 

        .out .shade {

            position: absolute;

 

            top: 0;

 

            width: 50%;

 

            height: 100%;

 

            background-color: rgba(0, 0, 0, 0);/*不能使用opacity,不然会被子元素继承(会忽视子元素所设置的background-color: opacity)*/

 

            /*pointer-events: auto;*/

 

        /* }

 

        .out .shade_left {

            left: 0;

 

        }

 

        .out .shade_right {

            right: 0;

 

        }

 

        .out .img li {

            position: absolute;

 

            top: 0;

 

            left: 0;

 

            display: none;

 

            /*pointer-events: none; //该层会将事件会传给下面一个层(z-index小于他的层) */

 

        /* }

 

        .out .num {

            position: absolute;

 

            font-size: 0;

 

            bottom: 10px;

 

            width: 100%;

 

            text-align: center;

 

        }

 

        .out .num li {

            width: 20px;

 

            height: 20px;

 

            background-color: #777;

 

            color: #fff;

 

            line-height: 20px;

 

            text-align: center;

 

            -webkit-border-radius: 50%;

 

            -moz-border-radius: 50%;

 

            border-radius: 50%;

 

            display: inline-block;

 

            font-size: 13px;

 

            margin: 0 3px;

 

            cursor: pointer;

 

        }

 

        .out .num li.active {

            background-color: #b92c28;

 

        }

 

        .out .btn {

            position: absolute;

 

            top: 50%;

 

            margin-top: -50px;

 

            color: #fff;

 

            height: 100px;

 

            line-height: 100px;

 

            width: 50px;

 

            background-color: rgba(0, 0, 0, 0.2);

 

            font-size: 40px;

 

            text-align: center;

 

            cursor: pointer;

 

            display: none;

 

        }

 

        .out .left {

            left: 0;

 

        }

 

        .out .right {

            right: 0;

 

        } */

 

        .footer {

            position: relative;

            padding-top: 521px;

            min-height: 276px;

            background: url(https://xyq.res.netease.com/pc/gw/20170118103441/img/ft2_7b14393.webp) no-repeat center top;

            background-color: #86a5d3;

        }

        .west-01 {

    position: absolute;

    width: 200px;

    height: 180px;

    left: 50%;

    margin-left: -398px;

    top: 352px;

    background-image: url(https://xyq.res.netease.com/pc/gw/20170118103441/img/west_01_3ca39fe.png);

    background-repeat: no-repeat;

    -webkit-animation: play01 1.4s steps(8) infinite;

    -moz-animation: play01 1.4s steps(8) infinite;

    -ms-animation: play01 1.4s steps(8) infinite;

    animation: play01 1.4s steps(8) infinite;

}

.west-02 {

    position: absolute;

    width: 200px;

    height: 180px;

    left: 50%;

    margin-left: -198px;

    top: 356px;

    background-image: url(https://xyq.res.netease.com/pc/gw/20170118103441/img/west_02_47bad19.png);

    background-repeat: no-repeat;

    -webkit-animation: play02 1.4s steps(8) infinite;

    -moz-animation: play02 1.4s steps(8) infinite;

    -ms-animation: play02 1.4s steps(8) infinite;

    animation: play02 1.4s steps(8) infinite;

}

.west-03 {

    position: absolute;

    width: 170px;

    height: 240px;

    left: 50%;

    margin-left: -11px;

    top: 326px;

    background-image: url(https://xyq.res.netease.com/pc/gw/20170118103441/img/west_03_f962447.png);

    background-repeat: no-repeat;

    -webkit-animation: play03 1.4s steps(8) infinite;

    -moz-animation: play03 1.4s steps(8) infinite;

    -ms-animation: play03 1.4s steps(8) infinite;

    animation: play03 1.4s steps(8) infinite;

}

.west-04 {

    position: absolute;

    width: 210px;

    height: 200px;

    left: 50%;

    margin-left: 198px;

    top: 372px;

    background-image: url(https://xyq.res.netease.com/pc/gw/20170118103441/img/west_04_6516d80.png);

    background-repeat: no-repeat;

    -webkit-animation: play04 1.4s steps(8) infinite;

    -moz-animation: play04 1.4s steps(8) infinite;

    -ms-animation: play04 1.4s steps(8) infinite;

    animation: play04 1.4s steps(8) infinite;

}

 

    </style>

 

</head>

 

<body>

 

 

 

    <!-- <div class="out">

 

 

 

        <ul class="img">

 

            <li><a href="https://www.baidu.com/"><img src="img/0.jpg" alt=""></a></li>

 

            <li><a href=""><img src="img/0.jpg" alt=""></a></li>

 

            <li><a href=""><img src="img/2.jpg" alt=""></a></li>

 

            <li><a href=""><img src="img/3.jpg" alt=""></a></li>

 

            <li><a href=""><img src="img/4.jpg" alt=""></a></li>

 

        </ul>

 

 

 

        <div class="shade shade_left">

 

            <div class="left btn"><</div>

 

        </div>

 

        <div class="shade shade_right">

 

            <div class="right btn">></div>

 

        </div>

 

 

 

        <ul class="num"></ul>



 

    </div> -->

 

    <div class="footer">

        <div class="west-01"></div>

        <div class="west-02"></div>

        <div class="west-03"></div>

        <div class="west-04"></div>

        </div>

 

 

 

</body>

 

</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值