Files
Gutti/script.js
Sebastian Köhler 4af47e1976 Füge Navigation und umfassende SEO-Optimierung hinzu
- Sticky Navigation mit Logo und Menü-Links
- Mobile Hamburger-Menü mit Smooth Scroll
- Back-to-Top Button mit Scroll-Effekt
- Umfassende SEO Meta-Tags (Keywords, Description, Geo)
- Open Graph und Twitter Card Tags für Social Media
- Schema.org strukturierte Daten (InsuranceAgency, Person)
- robots.txt und sitemap.xml für Suchmaschinen
- Canonical URLs auf allen Seiten
- Local SEO Optimierung für Kallmünz/Regensburg
2026-02-10 23:16:57 +01:00

132 lines
3.8 KiB
JavaScript

// 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: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
maxZoom: 19
}).addTo(map);
// Custom icon
const axaIcon = L.divIcon({
className: 'custom-marker',
html: '<div style="background-color: #00008f; color: white; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; border: 3px solid white; box-shadow: 0 2px 8px rgba(0,0,0,0.3);">📍</div>',
iconSize: [40, 40],
iconAnchor: [20, 40]
});
// Add marker
const marker = L.marker([lat, lng], { icon: axaIcon }).addTo(map);
// Add popup
marker.bindPopup(`
<div style="text-align: center; padding: 10px;">
<strong>Andreas Guttenberger</strong><br>
Versicherungsfachmann (IHK)<br>
Am Fallgatter 6<br>
93183 Kallmünz / Traidendorf
</div>
`).openPopup();
}