var productseries = { percent: 0, timers: "", index: function () { var _w = $('body').width(), _w_2 = _w / 2, _h_series = $('.citrus .R .bottom').height() //系列 var $productLis = $('.citrus .productLis .li'), productLis_len = $('#visualTCon').data('len'), $pageNumber = $('.pageNumber') $pageNumber.html('1 / ' + productLis_len) var time = 4000; var transition_time = 1200; var time_with_trans = (time + transition_time) / 1000; //系列右下图 $('.productLis .pic').attr('data-swiper-parallax-x', _w_2) $('.citrus .R .bottom .pic').attr('data-swiper-parallax-y', _h_series) var productShow = new Swiper('.productShow', { loop: true, observer:true, observeParents:true, parallax: true, noSwiping: true, direction: 'vertical', speed: transition_time, }); //右上文字 var productTXTShow = new Swiper('.productText', { loop: true, observer:true, observeParents:true, parallax: true, noSwiping: true, direction: 'vertical', speed: transition_time, }); //切换效果及时间控制 var timer = new TweenMax.to('.timerCurrent', time / 1000, { css: { transform: 'scaleX(1)' }, ease: Linear.easeNone, onComplete: function () { productShow.slideNext(); productTXTShow.slideNext(); productLis.slideNext(); } }); timer.pause(); //系列左侧大图 var productLis = new Swiper('.productLis', { loop: true, observer:true, observeParents:true, noSwiping: true, parallax: true, speed: transition_time, on: { init: function () { timer.restart(); }, transitionStart: function () { timer.duration(time_with_trans) timer.restart(); $pageNumber.html((this.realIndex + 1) + ' / ' + productLis_len) }, slideChangeTransitionStart: function () { for (var i = 0; i < productLis_len; i++) { $productLis.find(i).find('.pic').css({ 'transform': 'translateX(0)' }) } } }, observer:true, observeParents:true }); $('.citrus .btnR').click(function (e) { productShow.slideNext(); productTXTShow.slideNext(); productLis.slideNext(); }) $('.citrus .btnL').click(function (e) { productShow.slidePrev(); productTXTShow.slidePrev(); productLis.slidePrev(); }) productLis.on('slideChange', function () { var current_slide = this.previousIndex; var new_slide = this.realIndex; }); }, } productseries.index();