mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-09 07:48:57 +00:00
update
This commit is contained in:
@@ -1,5 +1,69 @@
|
||||
// Add any JavaScript functionality here if needed
|
||||
// For example, you can add animations, smooth scroll, or event handlers
|
||||
// Dark Mode Toggle with Persistence
|
||||
const toggleCheckbox = document.getElementById('dark-mode-checkbox');
|
||||
|
||||
// Check for saved user preference
|
||||
if (localStorage.getItem('dark-mode') === 'enabled') {
|
||||
toggleCheckbox.checked = true;
|
||||
document.body.classList.add('dark-mode');
|
||||
}
|
||||
|
||||
toggleCheckbox.addEventListener('change', function() {
|
||||
if (this.checked) {
|
||||
document.body.classList.add('dark-mode');
|
||||
localStorage.setItem('dark-mode', 'enabled');
|
||||
} else {
|
||||
document.body.classList.remove('dark-mode');
|
||||
localStorage.setItem('dark-mode', 'disabled');
|
||||
}
|
||||
});
|
||||
|
||||
// Responsive Navbar Toggle
|
||||
const menuToggle = document.querySelector('.menu-toggle');
|
||||
const navLinks = document.querySelector('.nav-links');
|
||||
|
||||
if (menuToggle) {
|
||||
menuToggle.addEventListener('click', () => {
|
||||
navLinks.classList.toggle('active');
|
||||
});
|
||||
}
|
||||
|
||||
// Active Link Highlighting Based on Scroll
|
||||
const sections = document.querySelectorAll('section');
|
||||
const navLinksArray = document.querySelectorAll('.nav-links a');
|
||||
|
||||
window.addEventListener('scroll', () => {
|
||||
let current = '';
|
||||
|
||||
sections.forEach(section => {
|
||||
const sectionTop = section.offsetTop - 70;
|
||||
if (pageYOffset >= sectionTop) {
|
||||
current = section.getAttribute('id');
|
||||
}
|
||||
});
|
||||
|
||||
navLinksArray.forEach(link => {
|
||||
link.classList.remove('active');
|
||||
if (link.getAttribute('href') === `#${current}`) {
|
||||
link.classList.add('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Smooth Scroll for Older Browsers
|
||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
anchor.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
const target = document.querySelector(this.getAttribute('href'));
|
||||
if (target) {
|
||||
window.scrollTo({
|
||||
top: target.offsetTop - 60, // Adjust for navbar height
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Log when the page is loaded
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log('SeedPass landing page loaded');
|
||||
});
|
||||
|
Reference in New Issue
Block a user