zoukankan      html  css  js  c++  java
  • mui动态生成轮播图

    <div class="lunbo">
          <!--<img class="lunbo-img" src="img/shouye1.png" />-->
          <div class="mui-slider">
               <div class="mui-slider-group mui-slider-loop">
                                
               </div>
               <div class="mui-slider-indicator">
                                
               </div>
           </div>
    </div>
    function hotList() {
                $.ajax({
                    type: "post",
                    url: IP + "/mobile/ad/hotList.html",
                    dataType: "json",
                    success: function(data) {
                        console.log(JSON.stringify(data));
                        $('.mui-slider-group').empty();
                        $('.mui-slider-indicator').empty();
                        var length = data.data.list.length;
                        if(length == 1) {
                            console.log(data.data.list[0].src)
                            $('.mui-slider-group').append('<div class="mui-slider-item"><img class="lunbo-img" src="' + data.data.list[0].src + '" /></div>');
                        } else {
                            $('.mui-slider-group').append('<div class="mui-slider-item mui-slider-item-duplicate"><img class="lunbo-img" src="' + data.data.list[length - 1].src + '" /></div>');
                            $('.mui-slider-indicator').append('<div class="mui-indicator mui-active"></div>');
                            for(var i = 0; i < length; i++) {
                                $('.mui-slider-group').append('<div class="mui-slider-item"><img class="lunbo-img" src="' + data.data.list[i].src + '" /></div>');
                            }
                            $('.mui-slider-group').append('<div class="mui-slider-item mui-slider-item-duplicate"><img class="lunbo-img" src="' + data.data.list[0].src + '" /></div>');
                            for(var i = 0; i < length - 1; i++) {
                                $('.mui-slider-indicator').append('<div class="mui-indicator"></div>');
                            }
                        }
                        var gallery = mui('.mui-slider');
                        gallery.slider({
                            interval: 5000 //自动轮播周期,若为0则不自动播放,默认为0;
                        });
                    }
                });
            }
  • 相关阅读:
    解决Linux下gets函数警告
    freopen文件操作后控制台输入输出
    Linux C编程下没有 itoa()函数的问题
    codeforces 631A Interview
    codeforces 617BChocolate
    codeforces 630KIndivisibility(容斥原理)
    codeforces 633B A Trivial Problem
    codeforces 624B Making a String
    codeforce 621A(水题)
    codeforces 624A Save Luke(水题)
  • 原文地址:https://www.cnblogs.com/ccllj/p/9643129.html
Copyright © 2011-2022 走看看