|
@@ -6,7 +6,14 @@ var categoryHeight = $('.tab-box').height(), |
|
@@ -6,7 +6,14 @@ var categoryHeight = $('.tab-box').height(), |
6
|
|
6
|
|
7
|
var $intercept = $('.no-intercept'),
|
7
|
var $intercept = $('.no-intercept'),
|
8
|
$list = $('.brand-list-box'),
|
8
|
$list = $('.brand-list-box'),
|
9
|
- $listBox = $('.list-box');
|
9
|
+ $listBox = $('.list-box'),
|
|
|
10
|
+ $brandContent = $('.brand-content'),
|
|
|
11
|
+ $tabBox = $('.tab-box'),
|
|
|
12
|
+ $contentIndex = $('.content-index'),
|
|
|
13
|
+ $categoryNav = $('.category-nav'),
|
|
|
14
|
+ $channelTab = $('.channel-tab'),
|
|
|
15
|
+ $categoryContent = $('.category-content'),
|
|
|
16
|
+ $brandCha = $('.brand-cha');
|
10
|
|
17
|
|
11
|
require('../common');
|
18
|
require('../common');
|
12
|
require('./brand-cate/cate-all');
|
19
|
require('./brand-cate/cate-all');
|
|
@@ -48,14 +55,21 @@ function loadData(channel) { |
|
@@ -48,14 +55,21 @@ function loadData(channel) { |
48
|
gender: channel
|
55
|
gender: channel
|
49
|
},
|
56
|
},
|
50
|
success: function(data) {
|
57
|
success: function(data) {
|
51
|
- $('.brand-content').html(data);
|
58
|
+ $brandContent.html(data);
|
52
|
|
59
|
|
53
|
initialize();
|
60
|
initialize();
|
|
|
61
|
+
|
|
|
62
|
+ $('html,body').animate({
|
|
|
63
|
+ scrollTop: 0
|
|
|
64
|
+ }, 100, function() {
|
|
|
65
|
+ $tabBox.removeClass('fastening');
|
|
|
66
|
+ $contentIndex.removeClass('distance');
|
|
|
67
|
+ });
|
54
|
}
|
68
|
}
|
55
|
});
|
69
|
});
|
56
|
}
|
70
|
}
|
57
|
|
71
|
|
58
|
-$('.brand-cha').find('li').click(function() {
|
72
|
+$brandCha.find('li').click(function() {
|
59
|
gender = $(this).find('span').text().replace(/[^A-Za-z]+/g, '').toLowerCase();
|
73
|
gender = $(this).find('span').text().replace(/[^A-Za-z]+/g, '').toLowerCase();
|
60
|
|
74
|
|
61
|
$(this).addClass('focus').siblings().removeClass('focus');
|
75
|
$(this).addClass('focus').siblings().removeClass('focus');
|
|
@@ -79,15 +93,30 @@ $('.brand-tab').find('li').click(function() { |
|
@@ -79,15 +93,30 @@ $('.brand-tab').find('li').click(function() { |
79
|
$(this).addClass('active').siblings().removeClass('active');
|
93
|
$(this).addClass('active').siblings().removeClass('active');
|
80
|
|
94
|
|
81
|
if ($(this).hasClass('brand')) {
|
95
|
if ($(this).hasClass('brand')) {
|
82
|
- $('.brand-content').removeClass('hide').siblings().addClass('hide');
|
|
|
83
|
- $('.channel-tab').removeClass('hide');
|
|
|
84
|
- $('.brand-cha').removeClass('hide').siblings().addClass('hide');
|
96
|
+ $brandContent.removeClass('hide').siblings().addClass('hide');
|
|
|
97
|
+ $channelTab.removeClass('hide');
|
|
|
98
|
+ $brandCha.removeClass('hide').siblings().addClass('hide');
|
85
|
} else {
|
99
|
} else {
|
86
|
- $('.category-content').removeClass('hide').siblings().addClass('hide');
|
100
|
+ $categoryContent.removeClass('hide').siblings().addClass('hide');
|
87
|
$('.channel-tab').addClass('hide');
|
101
|
$('.channel-tab').addClass('hide');
|
88
|
}
|
102
|
}
|
89
|
|
103
|
|
90
|
initialize();
|
104
|
initialize();
|
|
|
105
|
+
|
|
|
106
|
+ // 页面切换回到头部
|
|
|
107
|
+ $('html,body').animate({
|
|
|
108
|
+ scrollTop: 0
|
|
|
109
|
+ }, 100, function() {
|
|
|
110
|
+ if (!$brandContent.hasClass('hide')) {
|
|
|
111
|
+ $tabBox.removeClass('fastening');
|
|
|
112
|
+ $contentIndex.removeClass('distance');
|
|
|
113
|
+ } else {
|
|
|
114
|
+ $tabBox.removeClass('fastening');
|
|
|
115
|
+ $categoryNav.removeClass('loca');
|
|
|
116
|
+ $('.blk-cate-all .content').removeClass('living');
|
|
|
117
|
+ $contentIndex.removeClass('distance');
|
|
|
118
|
+ }
|
|
|
119
|
+ });
|
91
|
});
|
120
|
});
|
92
|
|
121
|
|
93
|
if ($listBox.find('li').length <= 0) {
|
122
|
if ($listBox.find('li').length <= 0) {
|
|
@@ -97,24 +126,24 @@ if ($listBox.find('li').length <= 0) { |
|
@@ -97,24 +126,24 @@ if ($listBox.find('li').length <= 0) { |
97
|
$(window).scroll(function() {
|
126
|
$(window).scroll(function() {
|
98
|
var totalHeight = $('#yoho-header').height() + $('.tab-box').height();
|
127
|
var totalHeight = $('#yoho-header').height() + $('.tab-box').height();
|
99
|
|
128
|
|
100
|
- if (!$('.brand-content').hasClass('hide')) {
|
129
|
+ if (!$brandContent.hasClass('hide')) {
|
101
|
if ($(this).scrollTop() >= $('#yoho-header').height()) {
|
130
|
if ($(this).scrollTop() >= $('#yoho-header').height()) {
|
102
|
- $('.tab-box').addClass('fastening');
|
|
|
103
|
- $('.content-index').addClass('distance');
|
131
|
+ $tabBox.addClass('fastening');
|
|
|
132
|
+ $contentIndex.addClass('distance');
|
104
|
$('.list-box').css('top', $('.tab-box').height());
|
133
|
$('.list-box').css('top', $('.tab-box').height());
|
105
|
} else {
|
134
|
} else {
|
106
|
- $('.tab-box').removeClass('fastening');
|
|
|
107
|
- $('.content-index').removeClass('distance');
|
135
|
+ $tabBox.removeClass('fastening');
|
|
|
136
|
+ $contentIndex.removeClass('distance');
|
108
|
$('.list-box').css('top', totalHeight - $(this).scrollTop());
|
137
|
$('.list-box').css('top', totalHeight - $(this).scrollTop());
|
109
|
}
|
138
|
}
|
110
|
} else {
|
139
|
} else {
|
111
|
if ($(this).scrollTop() >= $('#yoho-header').height()) {
|
140
|
if ($(this).scrollTop() >= $('#yoho-header').height()) {
|
112
|
- $('.tab-box').addClass('fastening');
|
|
|
113
|
- $('.category-nav').addClass('loca');
|
141
|
+ $tabBox.addClass('fastening');
|
|
|
142
|
+ $categoryNav.addClass('loca');
|
114
|
$('.blk-cate-all .content').addClass('living');
|
143
|
$('.blk-cate-all .content').addClass('living');
|
115
|
} else {
|
144
|
} else {
|
116
|
- $('.tab-box').removeClass('fastening');
|
|
|
117
|
- $('.category-nav').removeClass('loca');
|
145
|
+ $tabBox.removeClass('fastening');
|
|
|
146
|
+ $categoryNav.removeClass('loca');
|
118
|
$('.blk-cate-all .content').removeClass('living');
|
147
|
$('.blk-cate-all .content').removeClass('living');
|
119
|
}
|
148
|
}
|
120
|
}
|
149
|
}
|