UNPKG

487 BJavaScriptView Raw
1export default function appendSlide(slides) {
2 const swiper = this;
3 const {
4 $wrapperEl,
5 params
6 } = swiper;
7
8 if (params.loop) {
9 swiper.loopDestroy();
10 }
11
12 if (typeof slides === 'object' && 'length' in slides) {
13 for (let i = 0; i < slides.length; i += 1) {
14 if (slides[i]) $wrapperEl.append(slides[i]);
15 }
16 } else {
17 $wrapperEl.append(slides);
18 }
19
20 if (params.loop) {
21 swiper.loopCreate();
22 }
23
24 if (!params.observer) {
25 swiper.update();
26 }
27}
\No newline at end of file