TA的每日心情 | 奋斗 2016-7-4 15:34 |
---|
签到天数: 6 天 [LV.2]偶尔看看I
注册会员
- 积分
- 171
|
<body>
<div class="swiper-container1">
<div class="swiper-wrapper">
<div class="swiper-slide swiper-slide1" data-hash="slide1">slider1</div>
<div class="swiper-slide" data-hash="slide2">slider2</div>
<div class="swiper-slide" data-hash="slide3">slider3</div>
<div class="swiper-slide" data-hash="slide4">slider4</div>
</div>
<span class="swiper-pagination" style=""></span>
<button class="btn">销毁Swiper</button>
</div>
</body>
<script src="js/jquery-1.10.1.min.js"></script>
<script>
var mySwiper1 = new Swiper('.swiper-container1', {
});
// *****销毁创建只能实现一轮*****
$(".btn").click(function(){
if($(this).text()=="销毁Swiper"){
$(this).text("创建Swiper");
mySwiper1.destroy(false);
}
else if($(this).text()=="创建Swiper"){
$(this).text("销毁Swiper");
var mySwiper2 = new Swiper('.swiper-container1',{});
}
})
</script>
销毁创建只能执行一轮 ,销毁机制的的原理有没有哪位大神理解,求指点... |
|