Skip to content

Commit a8c8240

Browse files
committed
Fix #11: Button now shows correctly
1 parent f8ff4f8 commit a8c8240

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ document.addEventListener('DOMContentLoaded', function() {
77
const leftmostElemIsShown = () => {
88
let { clientWidth, scrollLeft, scrollWidth } = meetupContainer
99
scrollLeft = Math.abs(scrollLeft)
10-
errorMargin = scrollWidth * 0.1
10+
errorMargin = scrollWidth * 0.01
1111

1212
res = (scrollLeft > scrollWidth - clientWidth - errorMargin)
1313
return res
1414
}
1515
const rightmostElemIsShown = () => {
1616
let { scrollLeft, scrollWidth } = meetupContainer
1717
scrollLeft = Math.abs(scrollLeft)
18-
errorMargin = scrollWidth * 0.1
18+
errorMargin = scrollWidth * 0.01
1919

2020
res = (scrollLeft < errorMargin)
2121
return res
@@ -41,7 +41,7 @@ document.addEventListener('DOMContentLoaded', function() {
4141
} else {
4242
activate(scrollLeftBtn)
4343
}
44-
44+
4545
// Check if the container is scrolled to the right
4646
if (rightmostElemIsShown()) {
4747
deactivate(scrollRightBtn)
@@ -80,7 +80,7 @@ document.addEventListener('DOMContentLoaded', function() {
8080

8181
// Also update on window resize in case the container size changes
8282
window.addEventListener('resize', updateButtonVisibility);
83-
83+
8484
} else {
8585
console.error('One or more required elements are missing from the DOM');
8686
}

0 commit comments

Comments
 (0)