if (mw()) { $('.productdetail-1 .txtcout').prepend($('.productdetail-1 .lunbo')) } var num = 4 var prodeltabs = new swiper('.productdetail-1 #prodeltabs',{ slidesperview : num-1, spacebetween : 30, breakpoints: { 1300: { slidesperview : num, } } }) var prodelcout = new swiper('.productdetail-1 #prodelcout',{}) var left = 0,right = num-1 $(prodeltabs.slides).eq(0).addclass('on') $(prodeltabs.slides).click(function(){ var inx = $(this).index() $(this).addclass('on').siblings().removeclass('on') prodelcout.slideto(inx,500 ,false) if (inx == right) { prodeltabs.slidenext(); right++ left++ } if (inx == left) { prodeltabs.slideprev(); right-- left-- } }) // 多行文本拆分 var guige = $('.productdetail-1 .guige') for (let k = 0; k < guige.length; k++) { var guigehtml = guige.eq(k).html() var rst if (!(guigehtml == undefined)) { rst = guigehtml .split('
') guige.eq(k).text('') for (let i = 0; i < rst.length; i++) { guige.eq(k).append('
  • '+rst[i]+'
  • ') } } }