zoukankan      html  css  js  c++  java
  • t-2.手机端简单轮播(无滑动效果)

    <div class="banner">
            <ul class="slide_ul">
                <li>
                    <a href="#">
                        <img src="images/pc5.jpg" alt="">
                    </a>
                </li>
                <li>
                    <a href="#">
                        <img src="images/pc1.jpg" alt="">
                    </a>
                </li>
                <li>
                    <a href="#">
                        <img src="images/pc2.jpg" alt="">
                    </a>
                </li>
                <li>
                    <a href="#">
                        <img src="images/pc3.jpg" alt="">
                    </a>
                </li>
                <li>
                    <a href="#">
                        <img src="images/pc4.jpg" alt="">
                    </a>
                </li>
                <li>
                    <a href="#">
                        <img src="images/pc5.jpg" alt="">
                    </a>
                </li>
                <li>
                    <a href="#">
                        <img src="images/pc1.jpg" alt="">
                    </a>
                </li>
            </ul>
    </div>
     
    /*无缝滑动轮播--start*/
    .banner{
        width:6.4rem;
        height:3.12rem;
        position:relative;           /*给ul做定位用*/
        overflow:hidden;
    }
    /*banner img*/
    .slide_ul{
        position:absolute;
        left:-6.4rem;
        width:44.8rem;                 /*增加图片重新修正width*/
        height:3.12rem;
    }
    .slide_ul li{
        display:block;
        float:left;
        width:6.4rem;
        height:3.12rem;
    }
    .slide_ul img{
        display:block;
        width:6.4rem;
        height:3.12rem;
    }
     
    .js
     
    // 摆放顺序 5123451  方便左右不同方向轮播
    var index=1 ;
    function auto(){
        index++;
        $(".slide_ul").animate({"left":-6.4*index+"rem"},500,
                                               //轮播转换一张用时
            function(){
                if(index===6){         //6=总添加照片张数-1
                    $(".slide_ul").css("left","-6.4rem");
                    index=1;
                }
            }
        )
    }
    //每三秒轮播一次
    timer=setInterval("auto()",3000);
     

  • 相关阅读:
    java中的类修饰符、成员变量修饰符、方法修饰符。
    java集合框架
    计算字符串最后一个单词的长度,单词以空格隔开。 java算法
    写出一个程序,接受一个由字母和数字组成的字符串,和一个字符,然后输出输入字符串中含有该字符的个数。不区分大小写。java算法
    在使用 interface 声明一个接口时,只可以使用那个修饰符修饰该接口?
    初始化数组的三种方式
    Evolved Policy Gradients
    Improving Generalization in Meta Reinforcement Learning using Learned Objectives
    RL^2: Fast Reinforcement Learning via Slow Reinforcement Learning
    How to Construct Deep Recurrent Neural Networks
  • 原文地址:https://www.cnblogs.com/stone5/p/9031677.html
Copyright © 2011-2022 走看看