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

Update index.html #1603

Closed
wants to merge 1 commit into from
Closed
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
34 changes: 33 additions & 1 deletion website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@
<a href="#contributors" class="no-new-tab">Contributors</a>
</li>
</ul>
<!-- Light/Dark mode toggle button -->
<button id="theme-toggle" class="text-gray-800 dark:text-gray-200 p-2 rounded-full focus:outline-none">
<span id="theme-toggle-icon">🌞</span> <!-- Default icon for light mode -->
</button>


<div class=" md:flex sm:flex flex-col justify-end">
<button id="menuButton">
<!-- Icons for Menu and X can be added via SVG or other methods -->
Expand Down Expand Up @@ -656,6 +661,33 @@ <h4 class="ml-4 text-xl font-bold text-white text-center">Steps to Contribute:</
const mobileMenu = document.getElementById('mobileMenu');
const menuLinks = document.getElementsByClassName('menu-link'); // Fixed selector


// JavaScript for theme toggle functionality
const themeToggleButton = document.getElementById('theme-toggle');
const themeToggleIcon = document.getElementById('theme-toggle-icon');

// Load saved theme from local storage
if (localStorage.getItem('theme') === 'dark') {
document.body.classList.add('dark');
themeToggleIcon.textContent = 'πŸŒ™'; // Icon for dark mode
} else {
themeToggleIcon.textContent = '🌞'; // Icon for light mode
}

// Toggle theme on button click
themeToggleButton.addEventListener('click', () => {
document.body.classList.toggle('dark');

// Update icon based on the current theme
if (document.body.classList.contains('dark')) {
themeToggleIcon.textContent = 'πŸŒ™';
localStorage.setItem('theme', 'dark');
} else {
themeToggleIcon.textContent = '🌞';
localStorage.setItem('theme', 'light');
}
});

// Function to toggle menu visibility
function toggleMenu() {
const isMenuOpen = mobileMenu.classList.toggle('hidden');
Expand Down Expand Up @@ -723,4 +755,4 @@ <h4 class="ml-4 text-xl font-bold text-white text-center">Steps to Contribute:</

</body>

</html>
</html>
Loading