...
|
...
|
@@ -8,11 +8,61 @@ class Group extends Page { |
|
|
constructor() {
|
|
|
super();
|
|
|
|
|
|
this.selector = {};
|
|
|
this.selector = {
|
|
|
tabSection: $('#fixedTab'),
|
|
|
floorsContentHeight: $('.floors').height(),
|
|
|
groupTab: $('.group-tab'),
|
|
|
filterTab: $('.filter-nav'),
|
|
|
groupListContent: $('.group-list')
|
|
|
};
|
|
|
this.bindEvents();
|
|
|
this.swiperTop();
|
|
|
|
|
|
$(window).scroll(() => {
|
|
|
window.requestAnimationFrame(this.scrollHandler.bind(this));
|
|
|
});
|
|
|
}
|
|
|
scrollHandler() {
|
|
|
// 滚动固定tab
|
|
|
let floorsContentHeight = this.selector.floorsContentHeight + 5;
|
|
|
|
|
|
console.log(floorsContentHeight);
|
|
|
if ($(window).scrollTop() > floorsContentHeight) {
|
|
|
this.selector.tabSection.addClass('float');
|
|
|
this.selector.groupListContent.addClass('mrt');
|
|
|
} else {
|
|
|
this.selector.tabSection.removeClass('float');
|
|
|
this.selector.groupListContent.removeClass('mrt');
|
|
|
}
|
|
|
}
|
|
|
bindEvents() {
|
|
|
this.selector.tabSection.on('click', this.fixedTab.bind(this));
|
|
|
this.selector.groupTab.on('click', this.groupTabChange.bind(this));
|
|
|
|
|
|
bindEvents() {}
|
|
|
}
|
|
|
fixedTab() {
|
|
|
let listHeight = this.selector.groupListContent.height();
|
|
|
let windowHeight = $(window).height();
|
|
|
|
|
|
// 商品列表超过一屏时
|
|
|
if (listHeight > windowHeight || listHeight === windowHeight) {
|
|
|
if (!this.selector.tabSection.hasClass('float')) {
|
|
|
this.selector.tabSection.addClass('float');
|
|
|
$(window).scrollTop(this.selector.floorsContentHeight + 10);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
groupTabChange(e) {
|
|
|
let target = $(e.target);
|
|
|
let channel = target.data('channel');
|
|
|
|
|
|
if (!target.hasClass('active')) {
|
|
|
this.selector.groupTab.find('.tiptext').removeClass('active');
|
|
|
target.addClass('active');
|
|
|
}
|
|
|
console.log(channel);
|
|
|
}
|
|
|
|
|
|
// 顶部swiper
|
|
|
swiperTop() {
|
...
|
...
|
@@ -29,6 +79,8 @@ class Group extends Page { |
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//
|
|
|
}
|
|
|
|
|
|
$(() => {
|
...
|
...
|
|