diff --git a/src/components/ref-gallery.webc b/src/components/ref-gallery.webc index 2f2414b..9330626 100644 --- a/src/components/ref-gallery.webc +++ b/src/components/ref-gallery.webc @@ -19,15 +19,15 @@ }); }; - const progress = ({ target: { scrollLeft, scrollLeftMax } }) => { - galleryIndicator.style.width = `${(scrollLeft / scrollLeftMax) * 100}%`; + const progress = ({ target: { scrollLeft, scrollWidth, offsetWidth } }) => { + galleryIndicator.style.width = `${(scrollLeft / (scrollWidth - offsetWidth)) * 100}%`; }; const isAtEnd = () => { - galleryTrack.scrollLeft === 0 + galleryTrack.scrollLeft <= 0 ? (galleryPrevious.disabled = true) : (galleryPrevious.disabled = false); - galleryTrack.scrollLeft === galleryTrack.scrollLeftMax + galleryTrack.scrollLeft >= galleryTrack.scrollWidth - galleryTrack.offsetWidth ? (galleryNext.disabled = true) : (galleryNext.disabled = false); };