fix: breadcrumbs and marquee not observing clones

This commit is contained in:
Oleksandr 2026-03-16 10:59:00 +02:00 committed by outfoxxed
parent bb43a9ca6c
commit b5d9c3e098
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
4 changed files with 23 additions and 19 deletions

View file

@ -192,13 +192,16 @@ document.addEventListener("DOMContentLoaded", () => {
});
}, observerOptions);
videos.forEach(v => {
videoObserver.observe(v);
v.addEventListener("ended", () => {
targetScrollX += itemWidth;
startAnimation();
const startObserving = () => {
const allVideos = scroller.querySelectorAll("video");
allVideos.forEach(v => {
videoObserver.observe(v);
v.addEventListener("ended", () => {
targetScrollX += itemWidth;
startAnimation();
});
});
});
};
// events
btnLeft?.addEventListener("click", () => {
@ -211,15 +214,15 @@ document.addEventListener("DOMContentLoaded", () => {
startAnimation();
});
container.addEventListener(
"wheel",
e => {
e.preventDefault();
targetScrollX += e.deltaY;
startAnimation();
},
{ passive: false }
);
// container.addEventListener(
// "wheel",
// e => {
// e.preventDefault();
// targetScrollX += e.deltaY;
// startAnimation();
// },
// { passive: false }
// );
container.addEventListener("touchstart", e => {
isDown = true;
@ -260,6 +263,7 @@ document.addEventListener("DOMContentLoaded", () => {
// init
setupClones();
startObserving();
setTimeout(() => {
updateDimensions();
container.classList.add("initialized");