|
地板
楼主 |
发表于 2017-1-5 10:25:52
|
只看该作者
var mySwiper = new Swiper('.swiper-containers',{报错指向这一行
autoplay : 2000,
autoplayDisableOnInteraction : false,
paginationClickable: true,
loop:true,
observer:true,//修改swiper自己或子元素时,自动初始化swiper
observeParents:true,//修改swiper的父元素时,自动初始化swiper
});
<div style="margin: 0 auto;height: 150px;width: 100%;overflow: hidden" class="swiper-containers swiper-container-horizontal">//这一行
<div class="swiper-wrapper" style="position: relative">
<div style="background-color: red" class="swiper-slide">
<div style="width: 100%;height: 20%;background-color: black;opacity: 0.5;margin-top: 120px;"></div>
</div>
<div style="background-color: brown" class="swiper-slide">
<div style="width: 100%;height: 20%;background-color: black;opacity: 0.3;margin-top: 120px;"></div>
</div>
<div style="background-color: yellow" class="swiper-slide">
<div style="width: 100%;height: 20%;background-color: black;opacity: 0.1;margin-top: 120px;"></div>
</div>
<div style="background-color: green" class="swiper-slide">
<div style="width: 100%;height: 20%;background-color: black;opacity: 0.7;margin-top: 120px;"></div>
</div>
</div>
</div> |
|