- Name in allen Dateien korrigiert - HTML-Seiten aktualisiert - Meta-Tags und Schema.org Daten angepasst - E-Mail-Adressen aktualisiert - README und Manifest-Dateien korrigiert
132 lines
3.8 KiB
JavaScript
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: '© <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 Gutenberger</strong><br>
|
|
Versicherungsfachmann (IHK)<br>
|
|
Am Fallgatter 6<br>
|
|
93183 Kallmünz / Traidendorf
|
|
</div>
|
|
`).openPopup();
|
|
} |