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

Remove non-functional dark/light theme toggle button and update relat… #5031

Merged
merged 1 commit into from
Jul 31, 2024
Merged
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
12 changes: 6 additions & 6 deletions assets/css/navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

}

#themeToggle{
/* #themeToggle{
border: none;
background-color: transparent;
}
} */
.logox {
display: flex;
font-size: 1.5rem;
Expand Down Expand Up @@ -63,13 +63,13 @@
width: 0;
transition: opacity .5s ease-in-out, width .5s ease-in-out ;
}
#themeToggleWrapper{
/* #themeToggleWrapper{
opacity: 0;
width: 0;
padding: 0;
margin: 0;
transition: opacity .5s ease-in-out,width .5s ease-in-out, padding .5s ease-in-out, margin .5s ease-in-out;
}
} */
.nav-linkss li{
margin-right: 1rem;
margin-left: 1rem;
Expand All @@ -90,11 +90,11 @@
width: auto;
transition: opacity .5s ease-in-out, width .1s ease-in-out ;
}
#themeToggleWrapper{
/* #themeToggleWrapper{
opacity: 1;
width:40px ;
transition: opacity .5s ease-in-out,width .5s ease-in-out;
}
} */
.nav-linkss li{
margin-left: 1rem;
margin-right: 1rem;
Expand Down
146 changes: 73 additions & 73 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,81 +186,81 @@ for (let i = 0; i < filterBtn.length; i++) {

// Code for enabling Light-Dark THEME

function toggleTheme() {
var slider = document.getElementById("themeToggle");
if (slider.checked) {
disableDarkTheme();
disableChangeColor();
} else {
enableDarkTheme();
changeColor();
}
}

function changeColor() {
var contributor = document.getElementById('total-contributors');
contributor.style.color = "black";
}

function disableChangeColor() {
var col = document.getElementById('total-contributors');
col.style.color = "white";
}

function enableDarkTheme() {
var elements = document.getElementsByTagName("*");
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
if (

element.tagName !== 'BODY' &&
!element.classList.contains('ignore-dark-theme') && //add ignore-dark-theme in classes that you dont want affected by the toggle
!element.classList.contains('project-category') &&
!element.classList.contains('footer')&&

element.tagName !== "BODY" &&
!element.classList.contains("ignore-dark-theme") &&
!element.classList.contains("project-category") &&
!element.classList.contains("footer")

) {
element.classList.add("dark-theme");
}
}
// function toggleTheme() {
// var slider = document.getElementById("themeToggle");
// if (slider.checked) {
// disableDarkTheme();
// disableChangeColor();
// } else {
// enableDarkTheme();
// changeColor();
// }
// }

// function changeColor() {
// var contributor = document.getElementById('total-contributors');
// contributor.style.color = "black";
// }

// function disableChangeColor() {
// var col = document.getElementById('total-contributors');
// col.style.color = "white";
// }

// function enableDarkTheme() {
// var elements = document.getElementsByTagName("*");
// for (var i = 0; i < elements.length; i++) {
// var element = elements[i];
// if (

// element.tagName !== 'BODY' &&
// !element.classList.contains('ignore-dark-theme') && //add ignore-dark-theme in classes that you dont want affected by the toggle
// !element.classList.contains('project-category') &&
// !element.classList.contains('footer')&&

// element.tagName !== "BODY" &&
// !element.classList.contains("ignore-dark-theme") &&
// !element.classList.contains("project-category") &&
// !element.classList.contains("footer")

// ) {
// element.classList.add("dark-theme");
// }
// }

// Adding specific background color for the footer
var footer = document.querySelector("footer");
if (footer) {
footer.classList.add("dark-theme");
}
}

function disableDarkTheme() {
var elements = document.getElementsByTagName("*");
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
if (
element.tagName !== "BODY" &&
!element.classList.contains("ignore-dark-theme") &&
!element.classList.contains("project-category")
) {
element.classList.remove("dark-theme");
}
}
}

window.onscroll = function () {
scrollFunction();
};

function scrollFunction() {
var wrapper = document.getElementById("themeToggleWrapper");
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
wrapper.style.opacity = "0";
} else {
wrapper.style.opacity = "1";
}
}
// var footer = document.querySelector("footer");
// if (footer) {
// footer.classList.add("dark-theme");
// }
// }

// function disableDarkTheme() {
// var elements = document.getElementsByTagName("*");
// for (var i = 0; i < elements.length; i++) {
// var element = elements[i];
// if (
// element.tagName !== "BODY" &&
// !element.classList.contains("ignore-dark-theme") &&
// !element.classList.contains("project-category")
// ) {
// element.classList.remove("dark-theme");
// }
// }
// }

// window.onscroll = function () {
// scrollFunction();
// };

// function scrollFunction() {
// var wrapper = document.getElementById("themeToggleWrapper");
// if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
// wrapper.style.opacity = "0";
// } else {
// wrapper.style.opacity = "1";
// }
// }

// contact form variables
const form = document.querySelector("[data-form]");
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@
<li><a href="#footer">Contact</a></li>
</ul>
<!-- Light-Dark theme SWITCH -->
<label id="themeToggleWrapper" class="theme-toggle" for="themeToggle">
<!-- <label id="themeToggleWrapper" class="theme-toggle" for="themeToggle">
<input type="checkbox" id="themeToggle" onclick="toggleTheme()" checked aria-label="Switch theme mode">
<span class="slider" style="width: 40px; height: 20px;"></span>
</label>
</label> -->

</nav>

Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading