//swiper var tabsSwiper = new Swiper('.index-product-list', { speed: 500, onSlideChangeStart: function(swiper) { $(".index-product-tabs .on").removeClass('on') $(".index-product-tabs li").eq(swiper.activeIndex).addClass('on') } }) //tabs 关联swiper $(".index-product-tabs li").on('touchstart click', function(e) { e.preventDefault(); $(this).addClass('on').siblings().remoClass('on'); tabsSwiper.slideTo($(this).index()); //tabsSwiper和上面的变量需要保持一致 })