`);
} else if ('description' === 'tab') {
const tabTags = document.querySelectorAll('.product-block--tab.content_tab');
const addElement = () => {
if ('descripción' === 'description' || 'descripción' === 'descripción' || 'descripción' === 'descriptif') {
let content = document.querySelector(`.desktop-show #descripción`);
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 #descripción`);
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 ('ajuste' === 'description' || 'ajuste' === 'descripción' || 'ajuste' === 'descriptif') {
let content = document.querySelector(`.desktop-show #ajuste`);
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 #ajuste`);
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);
}
if ('garantía' === 'description' || 'garantía' === 'descripción' || 'garantía' === 'descriptif') {
let content = document.querySelector(`.desktop-show #garantía`);
let currentNode = tabTags[2];
// 获取当前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 #garantía`);
let currentNode = tabTags[2];
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('descripción')
tabList.push('ajuste')
tabList.push('garantía')
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();
console.log('text: ', text)
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--16261596512447__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--16261596512447__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 ('descripción' === 'description' || 'descripción' === 'descripción' || 'descripción' === 'descriptif') {
let content = document.querySelector(`#Product-content-block-descripción .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 ('ajuste' === 'description' || 'ajuste' === 'descripción' || 'ajuste' === 'descriptif') {
let content = document.querySelector(`#Product-content-block-ajuste .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)
})();
garantía
Kemimoto ofrece el mejor producto del mercado y la mejor garantía de la industria. El comprador original de cada Storage Box & bag está cubierto por una garantía de 6 meses contra defectos de fabricación. ¿Cómo se puede presentar un reclamo de garantía? Antes de enviar algo a Kemimoto, complete el formulario correspondiente haciendo clic en el siguiente enlace: https://www.kemimoto.com/pages/warranty-form Complete el formulario, asegurándose de que cada campo esté llenado correctamente. Siga las instrucciones de cada página para la garantía o el proceso de devolución. El cliente es responsable de devolver los artículos a Kemimoto y de proporcionar información de seguimiento precisa. Conserve hasta que un miembro del equipo de Kemimoto se comunique con usted.
`);
} else if ('tab' === 'tab') {
const tabTags = document.querySelectorAll('.product-block--tab.content_tab');
const addElement = () => {
if ('garantía' === 'description' || 'garantía' === 'descripción' || 'garantía' === 'descriptif') {
let content = document.querySelector(`#Product-content-block-garantía .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;
}
}
}
addElement();
}
};
document.addEventListener('shopify:section:load', generateTab);
document.addEventListener('DOMContentLoaded', generateTab)
})();
TÉRMINOS DE GARANTÍA
Kemimoto ofrece el mejor producto del mercado y la mejor garantía de la industria. El comprador original de cada Storage Box & bag está cubierto por una garantía de 6 meses contra defectos de fabricación. ¿Cómo se puede presentar un reclamo de garantía? Antes de enviar algo a Kemimoto, complete el formulario correspondiente haciendo clic en el siguiente enlace: https://www.kemimoto.com/pages/warranty-form Complete el formulario, asegurándose de que cada campo esté llenado correctamente. Siga las instrucciones de cada página para la garantía o el proceso de devolución. El cliente es responsable de devolver los artículos a Kemimoto y de proporcionar información de seguimiento precisa. Conserve hasta que un miembro del equipo de Kemimoto se comunique con usted.