Port over FF handling of scrollbar offset

This commit is contained in:
Eric Bailey
2024-12-02 18:19:42 -06:00
parent 2e32d1dad6
commit e5470f946f
2 changed files with 10 additions and 4 deletions
+5 -2
View File
@@ -98,8 +98,11 @@
var htmlWidth = html.getBoundingClientRect().width;
var scrollbarWidth = (windowWidth - htmlWidth) / 2;
var scrollbarOffset = scrollbarWidth / 2;
html.style.setProperty('--scrollbar-offset', `${scrollbarOffset}px`);
html.style.setProperty('--scrollbar-offset-negative', `-${scrollbarOffset}px`);
var isFF = /firefox/i.test(navigator.userAgent)
if (!isFF) {
html.style.setProperty('--scrollbar-offset', `${scrollbarOffset}px`);
html.style.setProperty('--scrollbar-offset-negative', `-${scrollbarOffset}px`);
}
} catch (error) {}
</script>
</head>