Skip to content

Commit

Permalink
Merge pull request #19 from KaranSingh36752/patch-1
Browse files Browse the repository at this point in the history
Update script.js
  • Loading branch information
KorryKatti authored Oct 7, 2024
2 parents 6b37926 + 9848dc3 commit 0ac0ea6
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
const toggleIcon = document.querySelector(".toggle-theme");
const toggleIcon = document.querySelector(".toggle-theme");

function toggleDarkMode() {
document.body.classList.toggle("dark-mode");
const applyTheme = (isDarkMode) => {
const footer = document.querySelector(".footer");

if (document.body.classList.contains("dark-mode")) {
if (isDarkMode) {
document.body.classList.add("dark-mode");
document.body.style.backgroundColor = "#1b1f38";
document.body.style.color = "white";
footer.style.color = "white";
toggleIcon.classList.remove('fa-moon');
toggleIcon.classList.add('fa-sun');
} else {
document.body.classList.remove("dark-mode");
document.body.style.backgroundColor = "white";
document.body.style.color = "#1b1f38";
footer.style.color = "#1b1f38";
toggleIcon.classList.remove('fa-sun');
toggleIcon.classList.add('fa-moon');
}
}
};

function openModal() {
const toggleDarkMode = () => {
const isDarkMode = !document.body.classList.contains("dark-mode");
applyTheme(isDarkMode);
};

window.onload = () => {
const isDarkMode = false;
applyTheme(isDarkMode);
};

const openModal = () => {
document.getElementById("myModal").style.display = "flex";
}
};

function closeModal() {
const closeModal = () => {
document.getElementById("myModal").style.display = "none";
}
};

// Close the modal when clicking outside of the content
window.onclick = function (event) {
window.onclick = (event) => {
const modal = document.getElementById("myModal");
if (event.target == modal) {
closeModal();
closeModal();
}
};
};

0 comments on commit 0ac0ea6

Please sign in to comment.