langIos.js
3.86 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
var swiper = new Swiper('.swiper-container', {
loop: true,
speed:300,
observer: true,
observerParents: true,
autoplayDisableOnInteraction: false,
autoplay : {
delay:4000
},
onSlideChangeEnd: function(swipers){
swipers.update(); //swiper更新
},
pagination: {
el: '.swiper-pagination',
},
});
var langList = [
//中文 英文 阿拉伯文
{
foot1:'儲值',
foot2:'https://footseen.com/img/img1_cn.png',
foot3:'https://footseen.com/img/img2_cn.png',
foot4:'https://footseen.com/img/img3_cn.png',
foot5:'下載APP',
},
{
foot1:'Top-up',
foot2:'https://footseen.com/img/img1_en.png',
foot3:'https://footseen.com/img/img2_en.png',
foot4:'https://footseen.com/img/img3_en.png',
foot5:'Download APP',
},
{
foot1:'العربية',
foot2:'https://footseen.com/img/img1_ar.jpg',
foot3:'https://footseen.com/img/img2_ar.jpg',
foot4:'https://footseen.com/img/img3_ar.jpg',
foot5:'تحميل التطبيق',
}
]
var langType = 0;
var langStr =(navigator.language || navigator.browserLanguage).toLowerCase();
if(sessionStorage.lang == undefined || sessionStorage.lang == 'undefined'){
if(langStr.indexOf('ar')>=0){
sessionStorage.lang = 7;
$('.langTitle font').html('العربية');
langType = 2;
$('.langList p').eq(2).addClass('check');
} else if(langStr.indexOf('zh')>=0){
sessionStorage.lang = 2;
$('.langTitle font').html('繁體中文');
langType = 0;
$('.langList p').eq(0).addClass('check');
} else {
sessionStorage.lang = 1;
$('.langTitle font').html('English');
langType = 1;
$('.langList p').eq(1).addClass('check');
}
} else {
if(sessionStorage.lang == 7){
langType = 2;
$('.langTitle font').html('العربية');
$('.langList p').eq(2).addClass('check');
} else if(sessionStorage.lang == 2){
langType = 0;
$('.langTitle font').html('繁體中文');
$('.langList p').eq(0).addClass('check');
} else {
langType = 1;
$('.langTitle font').html('English');
$('.langList p').eq(1).addClass('check');
}
}
$(function(){
lang();
$('.langTitle').on('click',function(e){
$('.langList').show();
$('.langTitle img').attr('src','https://footseen.com/img/up2.png');
e.stopPropagation();
})
$('.langList p').on('click',function(e){
$(this).addClass('check').siblings().removeClass('check');
$('.langTitle font').html($(this).html());
$('.langList').hide();
$('.langTitle img').attr('src','https://footseen.com/img/down2.png');
sessionStorage.lang = $(this).attr('data-lang');
lang();
e.stopPropagation();
})
$(document).on('click',function(e){
$('.langList').hide();
$('.langTitle img').attr('src','https://footseen.com/img/down2.png');
e.stopPropagation();
})
})
function lang(){
if(sessionStorage.lang == 1){
langType = 1;
} else if(sessionStorage.lang == 2){
langType = 0;
} else if(sessionStorage.lang == 7){
langType = 2;
}
$('.swiper-container').removeClass('hide');
var str = '';
str += '<div class="swiper-wrapper">';
str += ' <div class="swiper-slide">';
str += ' <img src="'+langList[langType].foot2+'"/>';
str += ' </div>';
str += ' <div class="swiper-slide">';
str += ' <img src="'+langList[langType].foot3+'"/>';
str += ' </div>';
str += ' <div class="swiper-slide">';
str += ' <img src="'+langList[langType].foot4+'"/>';
str += ' </div>';
str += '</div>';
str += '<div class="swiper-pagination"></div>';
$('.swiper-container').html(str);
this.swiper.destroy(false);
this.swiper = new Swiper('.swiper-container', {
loop: true,
speed:300,
observer: true,
observerParents: true,
autoplayDisableOnInteraction: false,
autoplay : {
delay:4000
},
onSlideChangeEnd: function(swipers){
swipers.update(); //swiper更新
},
pagination: {
el: '.swiper-pagination',
},
});
$('.topUp').html(langList[langType].foot1);
$('.iosDown').html(langList[langType].foot5);
}