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

Created a toggle mode #102

Closed
wants to merge 1 commit 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
44 changes: 40 additions & 4 deletions css_files/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,35 @@ body {
}

header {
display: flex;
justify-content: center;
position: fixed;
top: 0;
left: 0;
width: 100%;
text-align: center;
letter-spacing: 0.5em;
font-weight: 900;
background-color: #00bcd4;
/* background-color: #00bcd4; */
background-color: var(--background-color1);
color: #fff;
padding: 1rem 0;
z-index: 1000;
/* to Ensure the header is above other elements */

}
header h1{
text-align: center;
/* margin-left: 380px; */
}

.navbar {
position: fixed !important;
top: 80px;
left: 0;
width: 100%;
background-color: #00796b;
/* background-color: #00796b; */
background-color: var(--background-color2);
overflow: hidden;
z-index: 1000;
z-index: 1000;
Expand Down Expand Up @@ -109,7 +117,8 @@ a:hover {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
/* background-color: #fff; */
background-color: var(--background-color3);
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
Expand Down Expand Up @@ -194,7 +203,8 @@ a:hover {
}

footer {
background-color: #00796b;
/* background-color: #00796b; */
background-color: var(--background-color2);
color: #fff;
padding: 20px;
text-align: center;
Expand Down Expand Up @@ -225,6 +235,7 @@ footer {

p {
margin: 0;
color: var(--primary-color1);
}

#notification {
Expand Down Expand Up @@ -410,4 +421,29 @@ body:hover {
scrollbar-color: #008000 #CCFFCC;

}
}

#icon {
width: 45px;
height: 40px;
/* margin-left: 346px; */
cursor: pointer;
}

#icon:hover {
transform: scale(1.1);
}
:root{
--background-color1:#00bcd4;
--background-color2:#00796b;
--background-color3:#fff;
--primary-color1:#333;

}
.dark-theme{
--background-color1:#022429;
--background-color2:#01413a;
--background-color3:#000;
--primary-color1:#fff;

}
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@

<header>
<h1>WELLNESS WAVE</h1>
<div class="light_dark">
<img src="moon-icon2.jpg" alt="" id="icon">
</div>
</header>
<script src="toggle.js"></script>
<div class="navbar" id="navbar_home">
<ul>
<li class="navlist"><a href="./index.html" class="home">Home</a></li>
Expand Down
Binary file added moon-icon2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sun-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions toggle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var icon = document.getElementById("icon");
icon.onclick = function () {
document.body.classList.toggle("dark-theme");
if (document.body.classList.contains("dark-theme")) {
icon.src = "sun-icon.png";
}
else {
icon.src = "moon-icon2.jpg";
}
}