fix: 🐛 calculate end of gallery track correctly in all browsers
This commit is contained in:
parent
cbc41e74ba
commit
8c21edac0e
1 changed files with 4 additions and 4 deletions
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue