Spaces:
Running
Running
File size: 1,416 Bytes
fe27297 fd51224 fe27297 fd51224 fe27297 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
document.addEventListener('DOMContentLoaded', () => {
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Dark mode toggle
const darkModeToggle = document.getElementById('darkModeToggle');
if (darkModeToggle) {
darkModeToggle.addEventListener('click', () => {
document.documentElement.classList.toggle('dark');
});
}
// Initialize sidebar active state
const sidebarItems = document.querySelectorAll('custom-sidebar .sidebar-item');
sidebarItems.forEach(item => {
item.addEventListener('click', () => {
sidebarItems.forEach(i => i.classList.remove('active'));
item.classList.add('active');
});
});
// Page card click handler
document.querySelectorAll('.bg-white.rounded-lg.shadow').forEach(card => {
card.addEventListener('click', (e) => {
// Check if click was on a button inside the card
if (!e.target.closest('button')) {
console.log('Navigate to page editor');
// window.location.href = '/editor.html';
}
});
});
});
|