diff --git a/index.html b/index.html
index 62f6e91..296bb19 100644
--- a/index.html
+++ b/index.html
@@ -191,6 +191,22 @@
Contact
var reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
var scrollDebounce = null;
var lastScrollIndex = -1;
+ var programmaticScrollIndex = null;
+ var programmaticScrollTimer = null;
+
+ function clearProgrammaticScroll() {
+ programmaticScrollIndex = null;
+ if (programmaticScrollTimer) {
+ clearTimeout(programmaticScrollTimer);
+ programmaticScrollTimer = null;
+ }
+ }
+
+ function markProgrammaticScroll(index) {
+ programmaticScrollIndex = index;
+ if (programmaticScrollTimer) clearTimeout(programmaticScrollTimer);
+ programmaticScrollTimer = window.setTimeout(clearProgrammaticScroll, 1000);
+ }
function indexFromCenter() {
if (!carousel) return 0;
@@ -251,6 +267,7 @@ Contact
}
if (!fromScroll) {
+ markProgrammaticScroll(index);
scrollTabToCenter(index);
}
@@ -264,6 +281,10 @@ Contact
if (scrollDebounce) clearTimeout(scrollDebounce);
scrollDebounce = setTimeout(function () {
scrollDebounce = null;
+ if (programmaticScrollIndex !== null) {
+ clearProgrammaticScroll();
+ return;
+ }
var idx = indexFromCenter();
if (idx === lastScrollIndex) return;
setActive(idx, false, true);
@@ -314,7 +335,7 @@ Contact
tabs.forEach(function (t, i) {
if (t.classList.contains('is-active')) initialIndex = i;
});
- setActive(initialIndex, false, false);
+ setActive(initialIndex, false, true);
})();