Skip to content

Commit 348c1d7

Browse files
committed
fix: Set background for overscroll in OSX
1 parent c716cf6 commit 348c1d7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

assets/scripts/theme.js

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ if (localTheme === themeDark) {
1717
bodyClassList.add(themeDark);
1818
}
1919

20+
// Set background for overscroll (or elastic scrolling in OSX)
21+
function setBodyBackground(color) {
22+
const tc = document.querySelector(".theme-container");
23+
const cs = window.getComputedStyle(tc);
24+
document.body.style.background = cs.background;
25+
}
26+
setBodyBackground();
27+
2028
// Toggle theme on click
2129
themeToggle.addEventListener("click", () => {
2230
if (bodyClassList.contains(themeDark)) {
@@ -26,4 +34,5 @@ themeToggle.addEventListener("click", () => {
2634
bodyClassList.add(themeDark);
2735
localStorage.setItem(preferTheme, themeDark);
2836
}
37+
setBodyBackground();
2938
});

0 commit comments

Comments
 (0)