Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Smooth scroll for anchor links
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener('click', function (e) {
+ e.preventDefault();
+ document.querySelector(this.getAttribute('href')).scrollIntoView({
+ behavior: 'smooth'
+ });
+ });
+ });
+
+ // Add fade-in animation to posts
+ const posts = document.querySelectorAll('.post');
+ const observerOptions = {
+ threshold: 0.1
+ };
+
+ const observer = new IntersectionObserver((entries) => {
+ entries.forEach(entry => {
+ if (entry.isIntersecting) {
+ entry.target.style.opacity = '1';
+ entry.target.style.transform = 'translateY(0)';
+ }
+ });
+ }, observerOptions);
+
+ posts.forEach(post => {
+ post.style.opacity = '0';
+ post.style.transform = 'translateY(20px)';
+ post.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
+ observer.observe(post);
+ });
+
+ // Add dark mode toggle
+ const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)');
+ if (prefersDarkScheme.matches) {
+ document.body.classList.add('dark-mode');
+ }
+ });