mySwiper.prependSlide(slides)
添加slide到slides的第一个位置。可以是HTML元素或slide数组,例
mySwiper.prependSlide('<div class="swiper-slide">Slide 0</div>')
mySwiper.prependSlide([ '<div class="swiper-slide">Slide 1</div>', '<div class="swiper-slide">Slide 2</div>' ]);
mySwiper.prependSlide('<div class="swiper-slide">Slide 0</div>')
mySwiper.prependSlide([ '<div class="swiper-slide">Slide 1</div>', '<div class="swiper-slide">Slide 2</div>' ]);
mySwiper.prependSlide(slides)参数
- 启用版本:
- 3.0.0
使用方法示例
<script language="javascript">
var mySwiper = new Swiper('.swiper-container',{
})
mySwiper.prependSlide('<div class="swiper-slide">这是一个新的slide</div>'); //加到Swiper的第一个
</script>
转载原创文章请注明:文章转载自:Swiper中文网 [https://3.swiper.com.cn]
本文地址:https://3.swiper.com.cn/api/function/2015/0308/262.html