48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
const accTitles = document.querySelectorAll('.accordion-title');
|
|
|
|
accTitles.forEach(title => {
|
|
title.addEventListener('click', () => {
|
|
accTitles.forEach(otherTitle => {
|
|
if (otherTitle !== title) {
|
|
otherTitle.classList.remove('active');
|
|
otherTitle.nextElementSibling.style.display = 'none';
|
|
}
|
|
});
|
|
|
|
const content = title.nextElementSibling;
|
|
const isOpen = content.style.display === 'block';
|
|
title.classList.toggle('active');
|
|
content.style.display = isOpen ? 'none' : 'block';
|
|
});
|
|
});
|
|
|
|
const slides = document.querySelectorAll('.slide');
|
|
let currentIndex = 0;
|
|
|
|
function nextSlide() {
|
|
if (slides.length === 0) return;
|
|
|
|
slides[currentIndex].classList.remove('active');
|
|
currentIndex = (currentIndex + 1) % slides.length;
|
|
slides[currentIndex].classList.add('active');
|
|
}
|
|
|
|
if (slides.length > 0) {
|
|
slides[currentIndex].classList.add('active');
|
|
setInterval(nextSlide, 10000);
|
|
}
|
|
|
|
|
|
function toggleContent(button) {
|
|
const teaser = button.parentElement;
|
|
const fullContent = teaser.querySelector('.blog-full-content');
|
|
if (fullContent.style.display === 'none') {
|
|
fullContent.style.display = 'block';
|
|
button.textContent = 'Read Less';
|
|
} else {
|
|
fullContent.style.display = 'none';
|
|
button.textContent = 'Read More';
|
|
}
|
|
}
|
|
|