|
我用zepto.js框架加载image,为什么不轮播了- html:
- <div class="swiper-container">
- <div class="swiper-wrapper">
- </div>
- <div class="pagination"></div>
- </div>
- js:
- //图片轮播
- window.onload = function() {
- var mySwiper = new Swiper('.swiper-container',{
- //Your options here:
- mode:'horizontal',
- autoplay:2000,
- loop: true,
- speed:300,
- grabCursor : true,
- pagination: '.pagination'
- //etc..
- });
- mySwiper.startAutoplay();
- }
- zepto:
- function imgBannerCallback(ret){
- var imgBannerHtml='';
- for(var i in ret){
- var imgUrl=ret[i].image.url;
- //alert(JSON.stringify(ret[i].image));
- imgBannerHtml += '<div class="swiper-slide" ><img src="'+imgUrl+'" alt=""></div>';
- }
- $(".swiper-wrapper").append(imgBannerHtml);
- }
复制代码
|
|