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
This commit is contained in:
52
script.js
52
script.js
@@ -1,3 +1,37 @@
|
||||
// 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) {
|
||||
@@ -12,6 +46,24 @@ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
});
|
||||
});
|
||||
|
||||
// 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,
|
||||
|
||||
Reference in New Issue
Block a user