Create a complete website header for a Persian brand called "ایزی تریدینگ". Follow these detailed specifications and generate all necessary files (HTML, CSS, and JavaScript):
0c853c1 verified Download script.js from ARADSAMANI/persiantradingpeacock: direct link, hf CLI and curl.
- Browser
- Download file 1.79 kB
-
https://huggingface.co/spaces/ARADSAMANI/persiantradingpeacock/resolve/main/script.js
- Command line
-
hf download hf://spaces/ARADSAMANI/persiantradingpeacock/script.js
-
curl -L -o script.js https://huggingface.co/spaces/ARADSAMANI/persiantradingpeacock/resolve/main/script.js
1.79 kB
| ```javascript | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Theme Toggle | |
| const themeToggle = document.querySelector('.theme-toggle'); | |
| const body = document.body; | |
| const icon = themeToggle.querySelector('i'); | |
| // Check for saved theme preference | |
| const savedTheme = localStorage.getItem('theme'); | |
| if (savedTheme) { | |
| body.classList.add(savedTheme); | |
| updateThemeIcon(); | |
| } | |
| themeToggle.addEventListener('click', function() { | |
| body.classList.toggle('dark-theme'); | |
| body.classList.toggle('light-theme'); | |
| updateThemeIcon(); | |
| // Save theme preference | |
| const currentTheme = body.classList.contains('dark-theme') ? 'dark-theme' : 'light-theme'; | |
| localStorage.setItem('theme', currentTheme); | |
| }); | |
| function updateThemeIcon() { | |
| if (body.classList.contains('dark-theme')) { | |
| icon.classList.remove('fa-moon'); | |
| icon.classList.add('fa-sun'); | |
| } else { | |
| icon.classList.remove('fa-sun'); | |
| icon.classList.add('fa-moon'); | |
| } | |
| } | |
| // Hamburger Menu | |
| const hamburger = document.querySelector('.hamburger'); | |
| const navMenu = document.querySelector('.nav-menu'); | |
| hamburger.addEventListener('click', function() { | |
| hamburger.classList.toggle('active'); | |
| navMenu.classList.toggle('active'); | |
| }); | |
| // Close menu when clicking on a link (mobile) | |
| const navLinks = document.querySelectorAll('.nav-menu a'); | |
| navLinks.forEach(link => { | |
| link.addEventListener('click', function() { | |
| if (window.innerWidth <= 768) { | |
| hamburger.classList.remove('active'); | |
| navMenu.classList.remove('active'); | |
| } | |
| }); | |
| }); | |
| }); | |
| ``` |