var exist=false; var Idarray=[‘index‘]; for (var i = 0; i < Idarray.length; i++) { if (Idarray[i] == showedId) { exist = true; console.log(‘exist already‘); return; } } //only init when it doesn‘t exist. if (!exist) { Idarray.push(showedId); console.log(Idarray); new Swiper(‘#‘ + showedId + ‘-swiper‘, { pagination: ‘.swiper-pagination‘, paginationType: ‘fraction‘ }); }
swiper bugs if multi swipers exit
原文:http://www.cnblogs.com/defoliate/p/6888452.html