我正在尝试在ajax调用中添加一个懒惰的加载幻灯片,但不知道为什么图像没有显示
mySwiper.appendSlide(['<div class="swiper-slide"><img data-src="blabla.jpg" class="swiper-lazy"></div>']);
setTimeout(function () { mySwiper.update(); },500);
mySwiper.lazy.load( mySwiper.slides.length -1 );
mySwiper.slideTo(mySwiper.slides.length -1,500,false);
答案 0 :(得分:0)
改为将其添加到DOM
$(".swiper-wrapper div:last-child").after('<div class="swiper-slide"><img data-src="blabla.jpg" class="swiper-lazy"></div>');
setTimeout(function () { mySwiper.update(); },500);
mySwiper.slideTo(mySwiper.slides.length -1,500,false);