org-media-js/collapsible.js

18 lines
528 B
JavaScript
Raw Permalink Normal View History

2025-06-13 00:41:01 +03:00
document.addEventListener('DOMContentLoaded', function() {
var headers = document.querySelectorAll('h4');
headers.forEach(function(header) {
header.addEventListener('click', function() {
var nextElement = header.nextElementSibling;
if (nextElement) {
var collapsibleList = nextElement.querySelector('.playlist, .notes, .contents');
if (collapsibleList) {
header.classList.toggle('active');
collapsibleList.classList.toggle('active');
}
}
});
});
});