// Mobile Navigation Toggle const navToggle = document.getElementById('navToggle'); const navMenu = document.getElementById('navMenu'); const navLinks = document.querySelectorAll('.nav-link'); navToggle.addEventListener('click', () => { navToggle.classList.toggle('active'); navMenu.classList.toggle('active'); }); // Close mobile menu when clicking on a link navLinks.forEach(link => { link.addEventListener('click', () => { navToggle.classList.remove('active'); navMenu.classList.remove('active'); }); }); // Navbar scroll effect const navbar = document.getElementById('navbar'); let lastScroll = 0; window.addEventListener('scroll', () => { const currentScroll = window.pageYOffset; if (currentScroll > 50) { navbar.classList.add('scrolled'); } else { navbar.classList.remove('scrolled'); } lastScroll = currentScroll; }); // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) { target.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); // Back to Top Button const backToTopButton = document.getElementById('backToTop'); window.addEventListener('scroll', () => { if (window.pageYOffset > 300) { backToTopButton.classList.add('visible'); } else { backToTopButton.classList.remove('visible'); } }); backToTopButton.addEventListener('click', () => { window.scrollTo({ top: 0, behavior: 'smooth' }); }); // Add animation on scroll const observerOptions = { threshold: 0.1, rootMargin: '0px 0px -50px 0px' }; const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.style.opacity = '1'; entry.target.style.transform = 'translateY(0)'; } }); }, observerOptions); // Observe service cards and about items document.addEventListener('DOMContentLoaded', () => { const animatedElements = document.querySelectorAll('.service-card, .about-item'); animatedElements.forEach(el => { el.style.opacity = '0'; el.style.transform = 'translateY(20px)'; el.style.transition = 'opacity 0.6s ease, transform 0.6s ease'; observer.observe(el); }); // Initialize map initializeMap(); }); // Initialize Leaflet Map function initializeMap() { // Koordinaten: Am Fallgatter 6, 93183 Kallmünz / Traidendorf const lat = 49.17160; const lng = 11.94120; // Create map const map = L.map('map').setView([lat, lng], 16); // Add OpenStreetMap tiles L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors', maxZoom: 19 }).addTo(map); // Custom icon const axaIcon = L.divIcon({ className: 'custom-marker', html: '
📍
', iconSize: [40, 40], iconAnchor: [20, 40] }); // Add marker const marker = L.marker([lat, lng], { icon: axaIcon }).addTo(map); // Add popup marker.bindPopup(`
Andreas Guttenberger
Versicherungsfachmann (IHK)
Am Fallgatter 6
93183 Kallmünz / Traidendorf
`).openPopup(); }