function curState(){ var names = { 'Home':0, 'About':1, 'News':2, 'Products':3, 'Services':4, 'Invest':5, 'Join':6 }; if($('[data-name]').length>0){ var key = $('[data-name]').attr('data-name'); var i = names[key]; $('.pc-nav li').eq(i).addClass('cur').siblings().removeClass('cur'); }else{ $('.pc-nav li').removeClass('cur'); } } function proState(i){ $('.pc-nav .pro-navson .sec-item').eq(i).addClass('cur').siblings().removeClass('cur'); $('.pc-nav .pro-navson .sec-item').eq(i).find('.third-nav').stop().show(); } function enterAnimate(){ if(window.innerWidth>1024){ new WOW().init(); } } var Welcome = Barba.BaseView.extend({ namespace: 'welcome', onEnter: function () { }, onEnterCompleted: function () { enterAnimate(); curState(); proState(0); }, onLeave: function () { }, onLeaveCompleted: function () { } }); var About = Barba.BaseView.extend({ namespace: 'about', onEnter: function () { }, onEnterCompleted: function () { enterAnimate(); curState(); proState(0); $('.about-list .item').each(function(index,el){ $(el).find('.con-box').attr('data-wow-delay',.1+index*.2+'s'); }); $('.develop-box .time-tab .swiper-slide').eq(0).addClass('cur'); var timeSwiper = new Swiper('.develop-box .time-tab',{ slidesPerView:'auto', onlyExternal:true }); var developSwiper = new Swiper('.develop-box .text-tab',{ effect : 'fade', autoplay:3000, onlyExternal : true, fade: { crossFade: true }, prevButton:'.develop-box .text-tab .develop-prev', nextButton:'.develop-box .text-tab .develop-next', onInit:function(swiper){ if(window.innerWidth>1024){ swiperAnimateCache(swiper); swiperAnimate(swiper); } }, onSlideChangeEnd:function(swiper){ if(window.innerWidth>1024){ swiperAnimate(swiper); } }, onSlideChangeStart:function(swiper){ var i = swiper.activeIndex; $('.develop-box .time-tab .swiper-slide').eq(i).addClass('cur').siblings().removeClass('cur'); timeSwiper.slideTo(i); } }); developSwiper.params.control = timeSwiper; $('.develop-box .time-tab .swiper-slide').on('click',function(){ var i = $(this).index(); $('.develop-box .time-tab .swiper-slide').eq(i).addClass('cur').siblings().removeClass('cur'); developSwiper.slideTo(i); timeSwiper.slideTo(i); }); }, onLeave: function () { }, onLeaveCompleted: function () { } }); Welcome.init(); About.init(); Barba.Pjax.cacheEnabledas=false; Barba.Pjax.start();