services.js
2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//集团 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');
});