services.js 2.88 KB

//集团 tab 切换
var mySwiper2 = new Swiper('#swiper-tab',{
    watchSlidesProgress : true,
    watchSlidesVisibility : true,
    slidesPerView : 3,//将tabs块儿平均分成几份

    /*点击了上面的滑块时,下面的内容区也跟着变化  若去掉后,拖动下面上面可继续移动*/
    onTap: function(){
        mySwiper3.slideTo( mySwiper2.clickedIndex)
    }



})
var mySwiper3 = new Swiper('#swiper-con',{

    onSlideChangeStart: function(){
        updateNavPosition()
    }

})

function updateNavPosition(){
//默认哪一块是被选中的状态
    $('#swiper-tab .active-nav').removeClass('active-nav')
    var activeNav = $('#swiper-tab .swiper-slide').eq(mySwiper3.activeIndex).addClass('active-nav');


    if (!activeNav.hasClass('swiper-slide-visible')) {
        console.log(1);
        if (activeNav.index()>mySwiper2.activeIndex) {
            console.log(2);
            var thumbsPerNav = Math.floor(mySwiper2.width/activeNav.width())-1
            mySwiper2.slideTo(activeNav.index()-thumbsPerNav)
        }
        else {
            console.log(3);
            mySwiper2.slideTo(activeNav.index())
        }
    }
}

$('#services-soft-wrap li').on('click',function () {
    var _index = $(this).index();

    $('#services-wrap-sass').css('background-image','url(images/services_saasIco'+(_index+1)+'.png)')
    $('#services-soft-wrap li').eq(_index).addClass('active').siblings().removeClass('active');
    $('#services-soft-wrap li').children('div').addClass('displaynone');
    $('#services-soft-wrap li').eq(_index).children('div').removeClass('displaynone');
    // $('.ai-success-stories-list-bar').css('left',100*_index);
    $('#services-section-wrap>li').eq(_index).removeClass('displaynone').siblings().addClass('displaynone')
});

//车场 tab 切换
$('#services-park-wrap li').on('click',function () {
    var _index = $(this).index();
    $('#services_parkIco').css('background-image','url(images/services_parkIco'+(_index+1)+'.png)');
    $('#services-park-wrap li').eq(_index).addClass('active').siblings().removeClass('active');
    $('#services-park-wrap li').children('div').addClass('displaynone');
    $('#services-park-wrap li').eq(_index).children('div').removeClass('displaynone');
    $('#services-section-park>li').eq(_index).removeClass('displaynone').siblings().addClass('displaynone');
});

//车主 tab 切换
$('#services-user-wrap li').on('click',function () {
    var _index = $(this).index();
    $('#services_userIco').css('background-image','url(images/services_userIco'+(_index+1)+'.png)');
    $('#services-user-wrap li').eq(_index).addClass('active').siblings().removeClass('active');
    $('#services-user-wrap li').children('div').addClass('displaynone');
    $('#services-user-wrap li').eq(_index).children('div').removeClass('displaynone');
    $('#services-section-user>li').eq(_index).removeClass('displaynone').siblings().addClass('displaynone');
});