Update index.html
This commit is contained in:
37
index.html
37
index.html
@@ -1 +1,36 @@
|
||||
if you are seeing this, the hosting app is working.
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Dark Mode Test</title>
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Dark Mode Test</h1>
|
||||
<p>This is a simple dual-file dark mode website.</p>
|
||||
|
||||
<button id="toggle">Toggle Dark Mode</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const toggle = document.getElementById("toggle");
|
||||
|
||||
// Load saved theme
|
||||
if (localStorage.getItem("theme") === "dark") {
|
||||
document.body.classList.add("dark");
|
||||
}
|
||||
|
||||
toggle.addEventListener("click", () => {
|
||||
document.body.classList.toggle("dark");
|
||||
|
||||
// Save theme
|
||||
if (document.body.classList.contains("dark")) {
|
||||
localStorage.setItem("theme", "dark");
|
||||
} else {
|
||||
localStorage.setItem("theme", "light");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user