ana3n334
Anantara 安納塔拉|泰國·華欣|35年歷史,品牌首間度假酒店

<script>
document.addEventListener(“DOMContentLoaded”, function () {
document.querySelectorAll(“.e-n-tabs”).forEach(function (tabsContainer) {
let startX = 0, startY = 0, isMoving = false;
tabsContainer.addEventListener(“touchstart”, function (e) {
if (!e.touches || e.touches.length > 1) return;
startX = e.touches[0].clientX;
startY = e.touches[0].clientY;
isMoving = true;
}, false);

tabsContainer.addEventListener(“touchend”, function (e) {
if (!isMoving) return;
isMoving = false;
if (!e.changedTouches || e.changedTouches.length > 1) return;
const endX = e.changedTouches[0].clientX;
const endY = e.changedTouches[0].clientY;
if (Math.abs(endX – startX) < 40 || Math.abs(endY – startY) > 60) return;
const tabTitles = Array.from(
tabsContainer.querySelectorAll(“.e-n-tab-title”)
);
if (tabTitles.length < 2) return;
const activeIdx = tabTitles.findIndex((el) =>
el.getAttribute(“aria-selected”) === “true”
);
let newIdx = activeIdx;
if (endX < startX) {
// 左滑
newIdx = (activeIdx + 1) % tabTitles.length;
} else if (endX > startX) {
// 右滑
newIdx = (activeIdx – 1 + tabTitles.length) % tabTitles.length;
}
if (newIdx !== activeIdx) tabTitles[newIdx].click();
}, false);
});
});
</script>

.e-n-tabs-content > .e-active {
animation: slideIn 0.5s cubic-bezier(.33,1.53,.45,.9);
}
@keyframes slideIn {
from { opacity: 0; transform: translateX(30px);}
to { opacity: 1; transform: translateX(0);}
}