Я использую следующую структуру, где каждую статью можно создать в панели и настраиваемые (текст, стиль, изображения и т. д.)
Код: Выделить всё
slug() ?>">
style() ?>">
[img]" alt="">
Код: Выделить всё
function toggleSibling(element) {
const content = element.nextElementSibling;
// Close all other active content elements
const allContent = document.querySelectorAll('.content.active');
allContent.forEach(openContent => {
if (openContent !== content) {
openContent.classList.remove('active');
Array.from(openContent.children).forEach(child => {
child.style.transform = "";
child.style.opacity = "";
child.style.transition = "";
});
}
});
// Toggle the active class on sibling content
content.classList.toggle('active');
if (content.classList.contains('active')) {
// Add the falling animation
content.classList.add('fall');
setTimeout(() => {
content.classList.remove('fall');
console.log("Falling animation removed from:", content); // Debugging animation reset
}, 500);
} else {
// Reset styles if content is closed
content.classList.remove('active');
Array.from(content.children).forEach(child => {
child.style.transform = "";
child.style.opacity = "";
child.style.transition = "";
});
}
}
Страница должна оставаться одностраничной.
Спасибо. заранее вам за помощь!
Подробнее здесь: https://stackoverflow.com/questions/793 ... -one-pager
Мобильная версия