feat(extra-features): synchronize product thumbnail height
This commit is contained in:
@@ -66,6 +66,22 @@ function initStickyHeader() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sync product thumbs height with main images height
|
||||||
|
function syncThumbsHeight() {
|
||||||
|
const mainImages = document.querySelector(".product-main-images");
|
||||||
|
const thumbs = document.querySelector(".product-thumbs.swiper");
|
||||||
|
// Only apply if Swiper is vertical
|
||||||
|
if (mainImages && thumbs && thumbs.classList.contains("swiper-vertical")) {
|
||||||
|
thumbs.style.maxHeight = mainImages.offsetHeight + "px";
|
||||||
|
thumbs.style.height = mainImages.offsetHeight + "px";
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("load", syncThumbsHeight);
|
||||||
|
window.addEventListener("resize", syncThumbsHeight);
|
||||||
|
|
||||||
$(() => {
|
$(() => {
|
||||||
initStickyHeader();
|
initStickyHeader();
|
||||||
accLinksTriggerActive();
|
accLinksTriggerActive();
|
||||||
|
|||||||
Reference in New Issue
Block a user