首页 > swiper如何在同一个容器中新建一个swiper?

swiper如何在同一个容器中新建一个swiper?

有一个需求是点击一个按钮更滑swiper中的数据。
我如何把原有生成的swiper删除,加上新数据后在生成swiper呢?

cSwiper(".he");

function cSwiper(class) {
            var swiper = new Swiper(class, {
                paginationClickable: true,
                lazyLoading: true,
                preventClicks: false
            });
            return swiper
        }
        
$(".show li").click(function{
    //删除旧的
    $(".he").html(newhtml);
    // 生成新的
});

直接让swiper-wrapper的html设置为空再把新的内容加进去

【热门文章】
【热门文章】