Skip to content

Commit bb2e1db

Browse files
committed
fix: keep states of previous selections through website when changing pages
1 parent e24b9bc commit bb2e1db

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

website/index.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -417,22 +417,20 @@ <h2>Project Gamma</h2>
417417
scrollHorizontally: true,
418418

419419
onLeave: function(origin, destination, direction) {
420-
if (origin && origin.item) {
421-
const activeSlide = origin.item.querySelector(".fp-slide.active");
422-
423-
if (activeSlide && activeSlide.dataset.anchor && !activeSlide.dataset.anchor.endsWith("-text")) {
424-
window.fullpage_api.silentMoveTo(origin.index + 1, 0);
425-
}
426-
}
427-
428420
if (window.RaceNavigation) {
429421
window.RaceNavigation.update(destination.index, 0, direction);
430422
}
431423
},
432424

433425
afterLoad: function(origin, destination, direction) {
434426
if (window.RaceNavigation) {
435-
window.RaceNavigation.update(destination.index, 0, direction);
427+
let slideIndex = 0;
428+
if (destination && destination.item) {
429+
const slides = Array.from(destination.item.querySelectorAll(".fp-slide"));
430+
const activeSlide = destination.item.querySelector(".fp-slide.active");
431+
slideIndex = activeSlide ? slides.indexOf(activeSlide) : 0;
432+
}
433+
window.RaceNavigation.update(destination.index, slideIndex, direction);
436434
}
437435
},
438436

0 commit comments

Comments
 (0)