今天在layer中使用swiper,发现有滑不动现象
经过排查是初始化问题,还好layer中有success的回调函数
解决办法,将swiper的初始化写入success回调函数中
示例:
layer.open({ type: 1, title: false, closeBtn: 0, area: ['1000px', '600px'], shadeClose: true, success: function() { var Swiper = new Swiper('.swiper-container', { navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, pagination: { el: '.fuchuang .swiper-pagination', clickable: true, } }) } });
评论前必须登录!
注册