1
|
var $ = require('yoho-jquery'),
|
1
|
var $ = require('yoho-jquery'),
|
2
|
Swiper = require('yoho-swiper2');
|
2
|
Swiper = require('yoho-swiper2');
|
3
|
|
3
|
|
4
|
-var bannerSwiper,
|
|
|
5
|
- categoryHeight = $('.tab-box').height(),
|
4
|
+var categoryHeight = $('.tab-box').height(),
|
6
|
gender,
|
5
|
gender,
|
7
|
isBrand;
|
6
|
isBrand;
|
8
|
|
7
|
|
|
@@ -16,7 +15,25 @@ function channels(key) { |
|
@@ -16,7 +15,25 @@ function channels(key) { |
16
|
'women': 2,
|
15
|
'women': 2,
|
17
|
'lifestyle': 4
|
16
|
'lifestyle': 4
|
18
|
}[key];
|
17
|
}[key];
|
19
|
-};
|
18
|
+}
|
|
|
19
|
+
|
|
|
20
|
+function initialize() {
|
|
|
21
|
+ $('.banner-swiper').each(function() {
|
|
|
22
|
+ if ($(this).hasClass('swiper-container-horizontal') === false && $(this).find('li').length > 1) {
|
|
|
23
|
+ new Swiper(this, {
|
|
|
24
|
+ preloadImages: false,
|
|
|
25
|
+ lazyLoading: true,
|
|
|
26
|
+ lazyLoadingInPrevNext: true,
|
|
|
27
|
+ lazyLoadingOnTransitionStart: true,
|
|
|
28
|
+ loop: true,
|
|
|
29
|
+ autoplay: 3000,
|
|
|
30
|
+ autoplayDisableOnInteraction: false,
|
|
|
31
|
+ paginationClickable: true,
|
|
|
32
|
+ slideElement: 'li'
|
|
|
33
|
+ });
|
|
|
34
|
+ }
|
|
|
35
|
+ });
|
|
|
36
|
+}
|
20
|
|
37
|
|
21
|
function loadData(channel, isBrand) {
|
38
|
function loadData(channel, isBrand) {
|
22
|
var preUrl;
|
39
|
var preUrl;
|
|
@@ -38,19 +55,21 @@ function loadData(channel, isBrand) { |
|
@@ -38,19 +55,21 @@ function loadData(channel, isBrand) { |
38
|
$('.brand-content').html(data);
|
55
|
$('.brand-content').html(data);
|
39
|
} else {
|
56
|
} else {
|
40
|
$('.category-content').html(data);
|
57
|
$('.category-content').html(data);
|
41
|
- }
|
58
|
+ }
|
|
|
59
|
+
|
|
|
60
|
+ initialize();
|
42
|
}
|
61
|
}
|
43
|
});
|
62
|
});
|
44
|
}
|
63
|
}
|
45
|
|
64
|
|
46
|
$('.channel-tab').find('li').click(function() {
|
65
|
$('.channel-tab').find('li').click(function() {
|
47
|
- gender = $(this).find('span').text().replace(/[^A-Za-z]+/g, '').toLowerCase(),
|
66
|
+ gender = $(this).find('span').text().replace(/[^A-Za-z]+/g, '').toLowerCase();
|
48
|
isBrand = $('.brand-tab').find('.brand').hasClass('active');
|
67
|
isBrand = $('.brand-tab').find('.brand').hasClass('active');
|
49
|
|
68
|
|
50
|
$(this).addClass('focus').siblings().removeClass('focus');
|
69
|
$(this).addClass('focus').siblings().removeClass('focus');
|
51
|
|
70
|
|
52
|
loadData(channels(gender), isBrand);
|
71
|
loadData(channels(gender), isBrand);
|
53
|
-})
|
72
|
+});
|
54
|
|
73
|
|
55
|
// 点击字母,页面滚动到相关区域
|
74
|
// 点击字母,页面滚动到相关区域
|
56
|
$intercept.click(function() {
|
75
|
$intercept.click(function() {
|
|
@@ -75,21 +94,7 @@ $('.brand-tab').find('li').click(function() { |
|
@@ -75,21 +94,7 @@ $('.brand-tab').find('li').click(function() { |
75
|
$('.cate-cha').removeClass('hide').siblings().addClass('hide');
|
94
|
$('.cate-cha').removeClass('hide').siblings().addClass('hide');
|
76
|
}
|
95
|
}
|
77
|
|
96
|
|
78
|
- $('.banner-swiper').each(function() {
|
|
|
79
|
- if ($(this).hasClass('swiper-container-horizontal') === false && $(this).find('li').length > 1) {
|
|
|
80
|
- new Swiper(this, {
|
|
|
81
|
- preloadImages: false,
|
|
|
82
|
- lazyLoading: true,
|
|
|
83
|
- lazyLoadingInPrevNext: true,
|
|
|
84
|
- lazyLoadingOnTransitionStart: true,
|
|
|
85
|
- loop: true,
|
|
|
86
|
- autoplay: 3000,
|
|
|
87
|
- autoplayDisableOnInteraction: false,
|
|
|
88
|
- paginationClickable: true,
|
|
|
89
|
- slideElement: 'li'
|
|
|
90
|
- });
|
|
|
91
|
- }
|
|
|
92
|
- });
|
97
|
+ initialize();
|
93
|
});
|
98
|
});
|
94
|
|
99
|
|
95
|
$(function() {
|
100
|
$(function() {
|