`);
} else if ('description' === 'tab') {
const tabTags = document.querySelectorAll('.product-block--tab.content_tab');
const addElement = () => {
if ('description' === 'description') {
let content = document.querySelector(`.desktop-show #description`);
let currentNode = tabTags[0];
// 获取当前tab标签之后的兄弟元素,直到下一个tab标签出现
let sibling =currentNode.nextElementSibling;
while (sibling && sibling.tagName !== 'SCRIPT' && sibling.tagName !== 'STYLE' && !sibling.classList.contains('sticky-product-catalog-wrapper') && !sibling.classList.contains('tab-content') && !sibling.classList.contains('content_tab') && !sibling.classList.contains('hidden-all')) {
// 如果兄弟元素不是tab标签、固定 tab 栏、脚本、tab 栏内容区、样式表,则获取它的内容
const node = sibling.cloneNode(true);
node.classList.remove('invisible-ele');
content.appendChild(node);
sibling = sibling.nextElementSibling;
}
} else {
let content = document.querySelector(`.desktop-show #description`);
let currentNode = tabTags[0];
const innerContent = currentNode.querySelector('.collapsible-content__inner.rte');
const node = innerContent.cloneNode(true);
node.classList.remove('invisible-ele');
content.appendChild(node);
}
if ('warranty' === 'description') {
let content = document.querySelector(`.desktop-show #warranty`);
let currentNode = tabTags[1];
// 获取当前tab标签之后的兄弟元素,直到下一个tab标签出现
let sibling =currentNode.nextElementSibling;
while (sibling && sibling.tagName !== 'SCRIPT' && sibling.tagName !== 'STYLE' && !sibling.classList.contains('sticky-product-catalog-wrapper') && !sibling.classList.contains('tab-content') && !sibling.classList.contains('content_tab') && !sibling.classList.contains('hidden-all')) {
// 如果兄弟元素不是tab标签、固定 tab 栏、脚本、tab 栏内容区、样式表,则获取它的内容
const node = sibling.cloneNode(true);
node.classList.remove('invisible-ele');
content.appendChild(node);
sibling = sibling.nextElementSibling;
}
} else {
let content = document.querySelector(`.desktop-show #warranty`);
let currentNode = tabTags[1];
const innerContent = currentNode.querySelector('.collapsible-content__inner.rte');
const node = innerContent.cloneNode(true);
node.classList.remove('invisible-ele');
content.appendChild(node);
}
}
addElement();
}
let mql = window.matchMedia('(max-width: 767px)');
let isMobile = mql.matches;
const ul = document.querySelector('#pProductOverviewMenu ul');
const liList = document.querySelectorAll('#pProductOverviewMenu ul li');
const screenHeight = window.screen.height;
let fixedHeaderHeight = 0;
let tabList = [];
tabList.push('description')
tabList.push('warranty')
if (isMobile && tabList.length > 4) {
const arrow = document.querySelector('#pProductOverviewMenu button.arrow');
arrow.classList.remove('hide');
}
const getActive = ({id, upperCaseID, index}) => {
const target = document.querySelector(`#${id}`) || document.querySelector(`#${upperCaseID}`);
if (target) {
liList[index].classList.add('active')
liList.forEach((it, inx) => {
if (index !== inx) {
it.classList.remove('active');
}
})
if (isMobile) {
const liPosition = liList[index].offsetLeft + liList[index].offsetWidth >= ul.offsetWidth;
let scrollDistance = ul.offsetWidth;
scrollDistance = liPosition ? scrollDistance : -scrollDistance;
ul.scrollBy(scrollDistance, 0)
}
}
}
const contentArea = document.querySelectorAll(`.tab-content .content-area`);
const linkAnchor = () => {
liList.forEach((item, index) => {
item.onclick = (e) => {
let text = item.innerText.replaceAll(' ', '-');
text = text.toLowerCase();
if (isMobile) {
const menu = document.querySelector('.sticky-product-catalog #pProductOverviewMenu');
menu && menu.classList.remove('transform');
}
const upperCaseText = text.charAt(0).toUpperCase() + text.slice(1);
let target = document.querySelector(`#${text}`);
if (!target) target = document.querySelector(`#${upperCaseText}`);
const distance = window.scrollY + target.getBoundingClientRect().top;
const section = document.querySelector('#shopify-section-template--16046653210815__sub');
let mqlTablet = window.matchMedia('(min-width: 769px) and (max-width: 1000px)');
let mqlTablet2 = window.matchMedia('(min-width: 768px) and (max-width: 768px)');
let isTablet = mqlTablet.matches;
let isTablet2 = mqlTablet2.matches;
if (isTablet) {
window.scrollTo(0, section.offsetTop - 98)
} else if (isTablet2) {
window.scrollTo(0, section.offsetTop - 94)
} else {
window.scrollTo(0, section.offsetTop - 65)
}
addPadding();
const id = text;
const upperCaseID = id.charAt(0).toUpperCase() + id.slice(1);
getActive({
id,
upperCaseID,
index
})
contentArea.forEach(it => it.classList.remove('active'));
contentArea[index].classList.add('active');
}
})
}
const showStickyCatalog = (e) => {
// const fixHeaderNavigation = document.querySelector('#StickyHeaderWrap #SiteHeader.site-header--stuck');
const fixHeaderNavigation = document.querySelector('.sticky-ymm');
if (fixHeaderNavigation) {
const pProductOverviewMenu = document.querySelector('#pProductOverviewMenu');
const fixHeaderNavigationHeight = getComputedStyle(fixHeaderNavigation).height;
pProductOverviewMenu.style.top = fixHeaderNavigationHeight;
const catalog = getComputedStyle(ul).height;
fixedHeaderHeight = Number(fixHeaderNavigationHeight.replace('px', '')) + Number(catalog.replace('px', ''));
const scrollHeight = document.documentElement.scrollTop;
const pStickyTabBar = document.querySelector('.sticky-product-catalog');
const isHidePHeader = pStickyTabBar.classList.contains('hide');
// const features = document.querySelector(`#${tabList[0]}`);
// const featuresOffsetTop = features.offsetTop;
// if (scrollHeight >= featuresOffsetTop - 170) {
// if (isHidePHeader) {
// pStickyTabBar.classList.remove('hide');
// }
// } else {
// pStickyTabBar.classList.add('hide')
// }
}
};
const setActiveLi = () => {
const displayInScreen = [];
const nodeList = tabList.reduce((acc, cur) => {
const id = cur.toLowerCase();
const upperCaseID = id.charAt(0).toUpperCase() + id.slice(1);
const target = document.querySelector(`#${id}`) || document.querySelector(`#${upperCaseID}`);
target && acc.push(target);
return acc;
}, []);
nodeList.forEach((item, index) => {
const top = item.getBoundingClientRect().top - fixedHeaderHeight;
if (top <= 0) {
displayInScreen.push({
top,
index,
item
});
}
})
if (displayInScreen.length) {
const {top, index} = displayInScreen.sort((a, b) => b.top - a.top)[0];
const id = tabList[index];
const upperCaseID = id.charAt(0).toUpperCase() + id.slice(1);
getActive({
id,
upperCaseID,
index
})
}
}
function debounce(fn, delay = 10){
let timer = null //timer是闭包中的,不能被别人修改
return function(){
if(timer){
clearTimeout(timer)
}
timer = setTimeout(() => {
fn.apply(this, arguments);
showStickyCatalog();
timer = null
}, delay)
}
}
function setCatalogTop() {
const siteHeader = document.querySelector('#SiteHeader');
const catalog = document.querySelector('#shopify-section-template--16046653210815__sub');
let mql = window.matchMedia('(max-width: 767px)');
let isMobile = mql.matches;
catalog.style.top = isMobile ? getComputedStyle(siteHeader).height : `73.91px`;
}
function addPadding() {
const stickyWrapper = document.querySelector('.sticky-product-catalog-wrapper');
const stickyWrapperTop = stickyWrapper.getBoundingClientRect().top;
if (stickyWrapperTop <= 122) {
!stickyWrapper.classList.contains('stick') && stickyWrapper.classList.add('stick');
} else {
stickyWrapper.classList.remove('stick');
}
}
setTimeout(addPadding, 200)
setTimeout(() => {
linkAnchor();
setCatalogTop();
// window.addEventListener('scroll', debounce(setActiveLi))
}, 1000);
window.addEventListener("resize", debounce(setCatalogTop));
const mobileStickyBar = document.querySelector('.sticky-product-catalog #pProductOverviewMenu');
const arrow = document.querySelector('.sticky-product-catalog #pProductOverviewMenu .arrow');
if (arrow) {
arrow.addEventListener('click', () => {
mobileStickyBar.classList.contains('transform') ? mobileStickyBar.classList.remove('transform') : mobileStickyBar.classList.add('transform');
})
}
const stickyObserver = new IntersectionObserver((entries) => {
entries.forEach((entry, index, array) => {
// const catalogWrapper = document.querySelector('.sticky-product-catalog-wrapper');
// const isIntersectious = catalogWrapper.getBoundingClientRect().top <= 124;
addPadding()
});
}, {
root: null,
threshold: [0, 0.99, 1], // tips: 0.99 的目的是检测超出屏幕一点点立即往回滚的情况
rootMargin: `-124px 0px 0px 0px` // 声明顶部的 stickyHeaderHeight 和 ymm 的距离需要减掉
});
const catalogWrapper = document.querySelector('.sticky-product-catalog-wrapper');
stickyObserver.observe(catalogWrapper);
};
document.addEventListener('shopify:section:load', generateCatalog);
document.addEventListener('DOMContentLoaded', generateCatalog);
`);
} else if ('description' === 'tab') {
const tabTags = document.querySelectorAll('.product-block--tab.content_tab');
const addElement = () => {
if ('description' === 'description') {
let content = document.querySelector(`#Product-content-block-description .collapsible-content__inner`);
let currentNode = tabTags[0];
// 获取当前tab标签之后的兄弟元素,直到下一个tab标签出现
let sibling =currentNode.nextElementSibling;
while (sibling && sibling.tagName !== 'SCRIPT' && sibling.tagName !== 'STYLE' && !sibling.classList.contains('sticky-product-catalog-wrapper') && !sibling.classList.contains('tab-content') && !sibling.classList.contains('content_tab') && !sibling.classList.contains('hidden-all')) {
// 如果兄弟元素不是tab标签、固定 tab 栏、脚本、tab 栏内容区、样式表,则获取它的内容
const node = sibling.cloneNode(true);
node.classList.remove('invisible-ele');
content.appendChild(node);
sibling = sibling.nextElementSibling;
}
}
if ('warranty' === 'description') {
let content = document.querySelector(`#Product-content-block-warranty .collapsible-content__inner`);
let currentNode = tabTags[1];
// 获取当前tab标签之后的兄弟元素,直到下一个tab标签出现
let sibling =currentNode.nextElementSibling;
while (sibling && sibling.tagName !== 'SCRIPT' && sibling.tagName !== 'STYLE' && !sibling.classList.contains('sticky-product-catalog-wrapper') && !sibling.classList.contains('tab-content') && !sibling.classList.contains('content_tab') && !sibling.classList.contains('hidden-all')) {
// 如果兄弟元素不是tab标签、固定 tab 栏、脚本、tab 栏内容区、样式表,则获取它的内容
const node = sibling.cloneNode(true);
node.classList.remove('invisible-ele');
content.appendChild(node);
sibling = sibling.nextElementSibling;
}
}
}
addElement();
}
};
document.addEventListener('shopify:section:load', generateTab);
document.addEventListener('DOMContentLoaded', generateTab)
})();
`);
} else if ('tab' === 'tab') {
const tabTags = document.querySelectorAll('.product-block--tab.content_tab');
const addElement = () => {
}
addElement();
}
};
document.addEventListener('shopify:section:load', generateTab);
document.addEventListener('DOMContentLoaded', generateTab)
})();
CONDITIONS DE GARANTIE
Kemimoto fournit le meilleur produit sur le marché et la meilleure garantie de l'industrie. L'acheteur d'origine de chaque boîte de rangement et sac est couvert par une garantie de 6 mois contre les défauts de fabrication. Comment déposer une demande de garantie ? Avant d'envoyer quoi que ce soit à Kemimoto, veuillez remplir le formulaire approprié en cliquant sur le lien ci-dessous : https://www.kemimoto.com/pages/warranty-form Remplissez le formulaire en vous assurant que chaque champ est correctement rempli. Suivez les instructions de chaque page pour la garantie ou le processus de retour. Le client est responsable du retour des articles à Kemimoto et de la fourniture d'informations de suivi précises. Veuillez les conserver jusqu'à ce qu'un membre de l'équipe Kemimoto vous contacte.