Authored by 郝肖肖

'slideTo'

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