Replace color_scheme, data attr with Bootstrap media query
This commit is contained in:
@@ -30,19 +30,6 @@ function paigeResize() {
|
||||
}
|
||||
paigeResize();
|
||||
addEventListener("resize", paigeResize);
|
||||
{{ if $page.Param "paige.color_scheme" | not }}
|
||||
var paigeQuery = matchMedia("(prefers-color-scheme: dark)");
|
||||
if (paigeQuery.matches) {
|
||||
document.documentElement.setAttribute("data-bs-theme", "dark")
|
||||
}
|
||||
paigeQuery.addEventListener("change", function (e) {
|
||||
if (e.matches) {
|
||||
document.documentElement.setAttribute("data-bs-theme", "dark");
|
||||
} else {
|
||||
document.documentElement.removeAttribute("data-bs-theme");
|
||||
}
|
||||
});
|
||||
{{ end }}
|
||||
</script>
|
||||
{{ partial "paige/script.html" (dict "src" "paige/bootstrap/bootstrap.bundle.js") }}
|
||||
|
||||
|
Reference in New Issue
Block a user