Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark mode added to service page #1606

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions F&Q.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,50 @@
.btn-view-itinerary:hover {
background-color: #0056b3;
}

/* darkmode */
body {
background-color: white;
color: black;
transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
background-color: #121212;
color: #ffffff;
}

header.dark-mode {
background-color: #1f1f1f;
}

.mode-toggle {
cursor: pointer;
border: none;
background: transparent;
outline: none;
padding: 10px;
}

.mode-toggle img {
width: 24px;
height: 24px;
}

.navbar {
background-color: #f0f0f0;
transition: background-color 0.3s;
}

body.dark-mode .navbar {
background-color: #333;
}

body.dark-mode .navbar a:hover {
color: #4C51BF;
transform: translateY(-2px);
}

</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
</head>
Expand Down Expand Up @@ -527,6 +571,68 @@ <h2>Suggestions/Questions</h2>
background-color: #ffe0b2;
}
</style>

<!-- dark theme -->
<script>
document.addEventListener("DOMContentLoaded", function () {
const hamburger = document.getElementById("hamburger");
const navList = document.getElementById("nav-links");
const closeBtn = document.getElementById("closeBtn");

hamburger.addEventListener("click", function () {
navList.classList.toggle("active");
});

closeBtn.addEventListener("click", function () {
navList.classList.remove("active");
});
});

document.addEventListener("DOMContentLoaded", function() {
const modeToggle = document.getElementById("modeToggle");
const sunIcon = document.querySelector(".sun-icon");
const moonIcon = document.querySelector(".moon-icon");

// Check saved theme in localStorage and apply it
const currentTheme = localStorage.getItem("theme") || "light";
if (currentTheme === "dark") {
document.body.classList.add("dark-mode");
sunIcon.style.display = "none";
moonIcon.style.display = "inline-block";
} else {
sunIcon.style.display = "inline-block";
moonIcon.style.display = "none";
}

// Toggle between light and dark mode on button click
modeToggle.addEventListener("click", () => {
const isDarkMode = document.body.classList.toggle("dark-mode");

// Apply dark mode styles to relevant sections
const sections = document.querySelectorAll('.about, .core-values, .team');
sections.forEach(section => {
if (isDarkMode) {
section.classList.add('dark-mode');
} else {
section.classList.remove('dark-mode');
}
});

// Update icons and local storage
if (isDarkMode) {
sunIcon.style.display = "none";
moonIcon.style.display = "inline-block";
localStorage.setItem("theme", "dark");
} else {
sunIcon.style.display = "inline-block";
moonIcon.style.display = "none";
localStorage.setItem("theme", "light");
}
});
});
</script>
</body>
=======


<footer id="footer">
Expand Down
114 changes: 113 additions & 1 deletion service.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,53 @@
<title>Travel Services</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="service.css" rel="stylesheet">
<style>
/* dark mode css added*/

body {
background-color: white;
color: black;
transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
background-color: #121212;
color: #ffffff;
}

header.dark-mode {
background-color: #1f1f1f;
}

.mode-toggle {
cursor: pointer;
border: none;
background: transparent;
outline: none;
padding: 10px;
}

.mode-toggle img {
width: 24px;
height: 24px;
}

.navbar {
background-color: #f0f0f0;
transition: background-color 0.3s;
}

body.dark-mode .navbar {
background-color: #333;
}

body.dark-mode .navbar a:hover {
color: #4C51BF;
transform: translateY(-2px);
}


</style>
</head>
<body>
<header class="bg-primary text-white py-4">
Expand All @@ -25,6 +72,12 @@ <h1 class="display-4">Travel Services</h1>
<li class="nav-item"><a class="nav-link" href="#hotels">Hotels</a></li>
<li class="nav-item"><a class="nav-link" href="#flights">Flights</a></li>
<li class="nav-item"><a class="nav-link" href="#cars">Car Rentals</a></li>
<li>
<button class="mode-toggle" id="modeToggle">
<span class="sun-icon glow"><img src="day-mode.png" alt="Light mode"></span>
<span class="moon-icon glow" style="display: none;"><img src="moon.png" alt="Dark mode"></span>
</button>
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -215,5 +268,64 @@ <h5>Follow Us</h5>
</footer>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const hamburger = document.getElementById("hamburger");
const navList = document.getElementById("nav-links");
const closeBtn = document.getElementById("closeBtn");

hamburger.addEventListener("click", function () {
navList.classList.toggle("active");
});

closeBtn.addEventListener("click", function () {
navList.classList.remove("active");
});
});

document.addEventListener("DOMContentLoaded", function() {
const modeToggle = document.getElementById("modeToggle");
const sunIcon = document.querySelector(".sun-icon");
const moonIcon = document.querySelector(".moon-icon");

// Check saved theme in localStorage and apply it
const currentTheme = localStorage.getItem("theme") || "light";
if (currentTheme === "dark") {
document.body.classList.add("dark-mode");
sunIcon.style.display = "none";
moonIcon.style.display = "inline-block";
} else {
sunIcon.style.display = "inline-block";
moonIcon.style.display = "none";
}

// Toggle between light and dark mode on button click
modeToggle.addEventListener("click", () => {
const isDarkMode = document.body.classList.toggle("dark-mode");

// Apply dark mode styles to relevant sections
const sections = document.querySelectorAll('.about, .core-values, .team');
sections.forEach(section => {
if (isDarkMode) {
section.classList.add('dark-mode');
} else {
section.classList.remove('dark-mode');
}
});

// Update icons and local storage
if (isDarkMode) {
sunIcon.style.display = "none";
moonIcon.style.display = "inline-block";
localStorage.setItem("theme", "dark");
} else {
sunIcon.style.display = "inline-block";
moonIcon.style.display = "none";
localStorage.setItem("theme", "light");
}
});
});
</script>

</body>
</html>
</html>
Loading