$(function() { $('[data-id=' + pageobj._detailid + ']').addclass('active'); var i=$('[data-id=' + pageobj._detailid + ']').index(); $('.apply .con .big-box').eq(i).show().siblings().hide(); $('.apply-wrapper .con .swiper-container .swiper-slide').each(function(i,v){ var n=parseint($(this).find('h3').text())+1; $(this).find('h3').text('0'+n); }) $require(['swiper'], function() { var s1_swiper = new swiper('.apply-wrapper .swiper-container', { watchoverflow: true, autoplay: false, slidesperview: 2, navigation: { nextel: '.apply-wrapper .swiper-button-next', //自动隐藏 prevel: '.apply-wrapper .swiper-button-prev', //自动隐藏 }, breakpoints: { 768: { //当屏幕宽度大于等于768 slidesperview: 6 }, } }); var index=$('.apply-wrapper .swiper-slide.active').index(); s1_swiper.slideto(index); }) })