Authored by TaoHuang

fix js

... ... @@ -183,8 +183,31 @@ function tabInit() {
var tabs = $this.find('a.anchor');
var curTab = $this.find('a.anchor.active').attr('tab');
store.tab.tabs = tabs;
if ($this.hasClass('tab-fix')) {
store.tab.tabs = tabs;
}
let tabnames = tabs.map(function(i, el) {
return $(el).attr('tab');
}).get();
// 初始化选择状态
$('div[tabname]').each(function(index, el) {
let $el = $(el);
let tname = $el.attr('tabname');
if (!tabnames.includes(tname)) {
return;
}
if ($el.attr('tabname') === curTab) {
$el.show();
} else {
$el.hide();
}
});
// 绑定单击事件
tabs.on('click', function() {
var tab = $(this);
var tabname = tab.attr('tab');
... ... @@ -201,25 +224,19 @@ function tabInit() {
$('div[tabname]').each(function(index, el) {
let $el = $(el);
let tname = $el.attr('tabname');
if ($el.attr('tabname') === tabname) {
if (!tabnames.includes(tname)) {
return;
}
if (tname === tabname) {
$el.show();
} else {
$el.hide();
}
});
});
$('div[tabname]').each(function(index, el) {
let $el = $(el);
if ($el.attr('tabname') === curTab) {
$el.show();
} else {
$el.hide();
}
});
});
}
... ...
... ... @@ -120,7 +120,7 @@
.feature-product-info {
float: left;
width: 288px;
margin-right: 20px;
margin-right: 24px;
margin-top: 25px;
overflow: hidden;
... ...