-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #494 from REHAN-18/new
fix the bugs ,ui, signup,feedback ui.. & REPONSIVE
- Loading branch information
Showing
5 changed files
with
406 additions
and
472 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,33 @@ | ||
const checkbox = document.getElementById('checkbox') | ||
const modeLabel = document.getElementById('mode-label') | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const checkbox = document.getElementById('checkbox'); | ||
const modeLabel = document.getElementById('mode-label'); | ||
|
||
// Check if dark mode is already enabled | ||
if (localStorage.getItem('theme') === 'dark') { | ||
document.documentElement.setAttribute('data-theme', 'dark') | ||
checkbox.checked = true | ||
modeLabel.textContent = 'Dark Mode' | ||
} | ||
// Check if checkbox and modeLabel exist | ||
if (!checkbox || !modeLabel) { | ||
console.error('Checkbox or Mode Label element not found!'); | ||
return; | ||
} | ||
|
||
// Add event listener for toggle switch | ||
checkbox.addEventListener('change', () => { | ||
if (checkbox.checked) { | ||
document.documentElement.setAttribute('data-theme', 'dark') | ||
localStorage.setItem('theme', 'dark') | ||
modeLabel.textContent = 'Dark Mode' | ||
// Check if dark mode is already enabled | ||
if (localStorage.getItem('theme') === 'dark') { | ||
document.documentElement.setAttribute('data-theme', 'dark'); | ||
checkbox.checked = true; | ||
modeLabel.textContent = 'Dark Mode'; | ||
} else { | ||
document.documentElement.setAttribute('data-theme', 'light') | ||
localStorage.setItem('theme', 'light') | ||
modeLabel.textContent = 'Light Mode' | ||
document.documentElement.setAttribute('data-theme', 'light'); | ||
modeLabel.textContent = 'Light Mode'; | ||
} | ||
}) | ||
|
||
// Add event listener for the toggle switch | ||
checkbox.addEventListener('change', () => { | ||
if (checkbox.checked) { | ||
document.documentElement.setAttribute('data-theme', 'dark'); | ||
localStorage.setItem('theme', 'dark'); | ||
modeLabel.textContent = 'Dark Mode'; | ||
} else { | ||
document.documentElement.setAttribute('data-theme', 'light'); | ||
localStorage.setItem('theme', 'light'); | ||
modeLabel.textContent = 'Light Mode'; | ||
} | ||
}); | ||
}); |
Oops, something went wrong.