Dateien nach "Minecraft-Modern-Theme/js" hochladen
This commit is contained in:
47
Minecraft-Modern-Theme/js/faq-accordion.js
Normal file
47
Minecraft-Modern-Theme/js/faq-accordion.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|
||||||
|
// === FAQ TABS FUNKTIONALITÄT ===
|
||||||
|
const tabButtons = document.querySelectorAll('.faq-tab-button');
|
||||||
|
const tabPanes = document.querySelectorAll('.faq-tab-pane');
|
||||||
|
|
||||||
|
tabButtons.forEach(button => {
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
// 1. Aktive Klassen von allen Buttons und Panes entfernen
|
||||||
|
tabButtons.forEach(btn => btn.classList.remove('active'));
|
||||||
|
tabPanes.forEach(pane => pane.classList.remove('active'));
|
||||||
|
|
||||||
|
// 2. Aktive Klasse zum geklickten Button hinzufügen
|
||||||
|
button.classList.add('active');
|
||||||
|
|
||||||
|
// 3. Den zugehörigen Inhalt (Pane) finden und aktivieren
|
||||||
|
const targetCategory = button.getAttribute('data-category');
|
||||||
|
const targetPane = document.querySelector(`.faq-tab-pane[data-category="${targetCategory}"]`);
|
||||||
|
if (targetPane) {
|
||||||
|
targetPane.classList.add('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// === FAQ AKKORDEON FUNKTIONALITÄT (bleibt gleich) ===
|
||||||
|
const faqItems = document.querySelectorAll('.faq-item');
|
||||||
|
|
||||||
|
faqItems.forEach(item => {
|
||||||
|
const question = item.querySelector('.faq-question');
|
||||||
|
const answer = item.querySelector('.faq-answer');
|
||||||
|
|
||||||
|
if (question && answer) {
|
||||||
|
question.addEventListener('click', () => {
|
||||||
|
// 'active' Klasse zum aktuellen Item togglen
|
||||||
|
const isActive = item.classList.toggle('active');
|
||||||
|
|
||||||
|
// Höhe der Antwort anpassen für smooth slide
|
||||||
|
if (isActive) {
|
||||||
|
answer.style.maxHeight = answer.scrollHeight + 'px';
|
||||||
|
} else {
|
||||||
|
answer.style.maxHeight = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
17
Minecraft-Modern-Theme/js/header-scroll.js
Normal file
17
Minecraft-Modern-Theme/js/header-scroll.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// /js/header-scroll.js
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
// WICHTIG: Das Skript nur ausführen, wenn wir NICHT im Customizer sind.
|
||||||
|
// Diese Prüfung ist robuster und funktioniert ohne PHP.
|
||||||
|
if ( window.location.href.includes('/wp-admin/customize.php') || ( window.parent && window.parent.wp && window.parent.wp.customize ) ) {
|
||||||
|
return; // Skript hier beenden, wenn wir im Customizer sind.
|
||||||
|
}
|
||||||
|
|
||||||
|
const header = document.querySelector('.site-header');
|
||||||
|
window.addEventListener('scroll', function() {
|
||||||
|
if (window.scrollY > 50) {
|
||||||
|
header.classList.add('scrolled');
|
||||||
|
} else {
|
||||||
|
header.classList.remove('scrolled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
55
Minecraft-Modern-Theme/js/slider-init.js
Normal file
55
Minecraft-Modern-Theme/js/slider-init.js
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
// Hole den Slider-Container
|
||||||
|
const heroSlider = document.querySelector('.hero-slider');
|
||||||
|
|
||||||
|
// Stelle sicher, dass der Slider auf der Seite existiert, bevor du versuchst, ihn zu konfigurieren
|
||||||
|
if (!heroSlider) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Konfiguration für den Slider vorbereiten
|
||||||
|
const swiperConfig = {
|
||||||
|
// Optionen für den Slider
|
||||||
|
loop: true, // Endloses Schleifen
|
||||||
|
|
||||||
|
// Autoplay
|
||||||
|
autoplay: {
|
||||||
|
delay: 5000, // 5 Sekunden pro Slide
|
||||||
|
disableOnInteraction: false, // Autoplay nicht nach Klick stoppen
|
||||||
|
},
|
||||||
|
|
||||||
|
// Wenn der Nutzer die Maus darüber bewegt, pausieren
|
||||||
|
pauseOnMouseEnter: true,
|
||||||
|
|
||||||
|
// Effekt
|
||||||
|
effect: 'fade', // Übergangseffekt: 'slide', 'fade', 'cube', etc.
|
||||||
|
fadeEffect: {
|
||||||
|
crossFade: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Prüfe, ob die Pfeile ausgeblendet werden sollen
|
||||||
|
if (sliderSettings.hideArrows === '1') {
|
||||||
|
heroSlider.classList.add('slider-hide-arrows');
|
||||||
|
} else {
|
||||||
|
// Navigation nur hinzufügen, wenn sie nicht ausgeblendet wird
|
||||||
|
swiperConfig.navigation = {
|
||||||
|
nextEl: '.swiper-button-next',
|
||||||
|
prevEl: '.swiper-button-prev',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prüfe, ob die Paginierung ausgeblendet werden soll
|
||||||
|
if (sliderSettings.hidePagination === '1') {
|
||||||
|
heroSlider.classList.add('slider-hide-pagination');
|
||||||
|
} else {
|
||||||
|
// Pagination nur hinzufügen, wenn sie nicht ausgeblendet wird
|
||||||
|
swiperConfig.pagination = {
|
||||||
|
el: '.swiper-pagination',
|
||||||
|
clickable: true, // Klick auf Punkt springt zum Slide
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialisiere den Slider mit der konfigurierten Optionen
|
||||||
|
new Swiper('.hero-slider', swiperConfig);
|
||||||
|
});
|
||||||
32
Minecraft-Modern-Theme/js/theme-toggle.js
Normal file
32
Minecraft-Modern-Theme/js/theme-toggle.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
const html = document.documentElement;
|
||||||
|
const toggle = document.querySelector('.theme-toggle');
|
||||||
|
const iconMoon = toggle.querySelector('.icon-moon');
|
||||||
|
const iconSun = toggle.querySelector('.icon-sun');
|
||||||
|
|
||||||
|
const defaultMode = typeof sliderSettings !== 'undefined' ? sliderSettings.defaultMode : 'dark';
|
||||||
|
const saved = localStorage.getItem('themeMode') || defaultMode;
|
||||||
|
|
||||||
|
if (saved === 'light') {
|
||||||
|
html.classList.add('light-mode');
|
||||||
|
iconMoon.style.display = 'none';
|
||||||
|
iconSun.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
iconMoon.style.display = 'block';
|
||||||
|
iconSun.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle.addEventListener('click', function () {
|
||||||
|
html.classList.toggle('light-mode');
|
||||||
|
|
||||||
|
if (html.classList.contains('light-mode')) {
|
||||||
|
iconMoon.style.display = 'none';
|
||||||
|
iconSun.style.display = 'block';
|
||||||
|
localStorage.setItem('themeMode', 'light');
|
||||||
|
} else {
|
||||||
|
iconMoon.style.display = 'block';
|
||||||
|
iconSun.style.display = 'none';
|
||||||
|
localStorage.setItem('themeMode', 'dark');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user