Update default.html

This commit is contained in:
wakgill
2021-01-03 03:05:27 -06:00
committed by GitHub
parent a43b9baa7f
commit dce78ba505
+17
View File
@@ -334,6 +334,23 @@ document.onmousedown = document.onmouseup = function(e) {
}
};
</script>
<script>const btn = document.querySelector(".btn-toggle");
const currentTheme = localStorage.getItem("theme");
if (currentTheme == "dark") {
document.body.classList.add("dark-theme");
}
btn.addEventListener("click", function () {
document.body.classList.toggle("dark-theme");
let theme = "light";
if (document.body.classList.contains("dark-theme")) {
theme = "dark";
}
localStorage.setItem("theme", theme);
});</script>
<!---The Times 03/Jan/2009 Chancellor on brink of second bailout for banks--->
</body>
</html>