This commit is contained in:
@@ -189,28 +189,28 @@
|
||||
|
||||
|
||||
//产品列表在hover复位tabs选择
|
||||
// const productNavContainer = document.querySelector('.header-nav-item:first-child');
|
||||
const productNavContainer = document.querySelector('.header-nav-item:first-child');
|
||||
|
||||
// if (productNavContainer) {
|
||||
// productNavContainer.addEventListener('mouseleave', () => {
|
||||
// // 延迟执行,确保下拉菜单已经隐藏
|
||||
// setTimeout(() => {
|
||||
// const tabs = document.querySelectorAll('.header-tab-item');
|
||||
// const contents = document.querySelectorAll('.header-tab-content');
|
||||
if (productNavContainer) {
|
||||
productNavContainer.addEventListener('mouseleave', () => {
|
||||
// 延迟执行,确保下拉菜单已经隐藏
|
||||
setTimeout(() => {
|
||||
const tabs = document.querySelectorAll('.header-tab-item');
|
||||
const contents = document.querySelectorAll('.header-tab-content');
|
||||
|
||||
// // 重置到第一个tab
|
||||
// if (tabs.length > 0 && tabs[0]) {
|
||||
// tabs.forEach(tab => tab.classList.remove('active'));
|
||||
// contents.forEach(content => content.classList.remove('active'));
|
||||
// 重置到第一个tab
|
||||
if (tabs.length > 0 && tabs[0]) {
|
||||
tabs.forEach(tab => tab.classList.remove('active'));
|
||||
contents.forEach(content => content.classList.remove('active'));
|
||||
|
||||
// tabs[0].classList.add('active');
|
||||
// const firstContentId = tabs[0].getAttribute('data-tab');
|
||||
// const firstContent = document.getElementById(firstContentId);
|
||||
// if (firstContent) firstContent.classList.add('active');
|
||||
// }
|
||||
// }, 350);
|
||||
// });
|
||||
// }
|
||||
tabs[0].classList.add('active');
|
||||
const firstContentId = tabs[0].getAttribute('data-tab');
|
||||
const firstContent = document.getElementById(firstContentId);
|
||||
if (firstContent) firstContent.classList.add('active');
|
||||
}
|
||||
}, 350);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user