Authored by 郝肖肖

'slideTo'

@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <div class="swiper-container droit-nav"> 4 <div class="swiper-container droit-nav">
5 <div class="swiper-wrapper"> 5 <div class="swiper-wrapper">
6 {{#vipNav}} 6 {{#vipNav}}
7 - <div class="swiper-slide droit-nav-item {{#if active}}active{{/if}}"> 7 + <div class="swiper-slide droit-nav-item {{#if active}}active1{{/if}}">
8 <img class="droit-nav-icon" src="{{image iosSmallImage 100 100}}" /> 8 <img class="droit-nav-icon" src="{{image iosSmallImage 100 100}}" />
9 <span class="name">{{displayName}}</span> 9 <span class="name">{{displayName}}</span>
10 </div> 10 </div>
@@ -25,12 +25,16 @@ class GradeDroitPage extends Page { @@ -25,12 +25,16 @@ class GradeDroitPage extends Page {
25 this.bindEvents(); 25 this.bindEvents();
26 this._setScroll(); 26 this._setScroll();
27 27
28 - new Swiper('.swiper-container', { 28 + let mySwiper = new Swiper('.swiper-container', {
29 slidesPerView: 'auto', 29 slidesPerView: 'auto',
30 onTap: function(swiper, event) { 30 onTap: function(swiper, event) {
31 that._navEvent(event); 31 that._navEvent(event);
32 } 32 }
33 }); 33 });
  34 + let $active = this.selector.$droitNav.find('.droit-nav-item.active1');
  35 +
  36 + $active.addClass('active').removeClass('active1');
  37 + mySwiper.slideTo($active.index(), 1000, false);// 切换到第一个slide,速度为1秒
34 } 38 }
35 39
36 bindEvents() { 40 bindEvents() {