• JQ轮播图


    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
    *{
    margin: 0;
    padding: 0;
    }
    .slider{
    400px;
    height: 400px;
    overflow: hidden;
    }
    .slider .slides{
    6000px;
    height: 400px;
    }
    .slider .slide{
    float: left;
    list-style-type: none;
    720px;
    height: 400px;

    }
    .slider .slide img{
    720px;
    }
    </style>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <script src="js/jquery-2.1.1.min.js" type="text/javascript" charset="utf-8"></script>
    </head>
    <body>
    <div class="container">
    <div class="header">
    <h1 class="text-muted">
    jQuery Basic Slide
    </h1>
    </div>
    <div class="slider">
    <ul class="slides">
    <li class="slide"><img src="img/1.jpg" alt="" /></li>
    <li class="slide"><img src="img/2.jpg" alt="" /></li>
    <li class="slide"><img src="img/3.jpg" alt="" /></li>
    <li class="slide"><img src="img/4.jpg" alt="" /></li>
    <li class="slide"><img src="img/1.jpg" alt="" /></li>
    </ul>
    </div>
    </div>
    <script type="text/javascript">
    $(function(){
    // 定义一个宽度
    var width = 720;
    //定义一个速度时间
    var animateSpeed = 1000;
    // 每隔多少秒调用一次
    var pause = 3000;
    // 获取大的div
    var $slider = $('.slider');
    // var $slideContainner = $('.slides');
    var $slideContainer = $slider.find('.slides');
    var $slides = $slideContainer.find('.slide');
    var currentSlide = 1;
    var interval;
    function startSlide(){
    interval=setInterval(function(){
    $slideContainer.animate({'margin-left':'-='+width},
    animateSpeed,function(){
    currentSlide++;
    if(currentSlide===$slides.length){
    currentSlide=1;
    $slideContainer.css('margin-left',0);
    }
    });

    },pause)
    };
    // 鼠标移入移出事件
    $slider.on('mouseenter',pauseSlider).on('mouseleave',
    startSlide);
    function pauseSlider(){
    clearInterval(interval);
    interval=null;
    }
    startSlide();

    });
    </script>
    </body>
    </html>

  • 相关阅读:
    解决Manjaro i3社区版 compton默认配置不正确的问题
    Manjaro 18.1.5 i3社区版安装后初步配置
    Manjaro Linux 18 中安装配置搜狗拼音输入法
    博客园美化(最全)
    vritulbox中linux安装zookeeper报错:
    eclipse中springmvc框架出现404
    ajax
    JSP
    请求转发和重定向的区别:
    本周授课内容:http,https,Tomcat,servlet
  • 原文地址:https://www.cnblogs.com/weixin2623670713/p/13029466.html
Copyright © 2020-2023  润新知