add collapsible
This commit is contained in:
commit
26179adbf8
1 changed files with 17 additions and 0 deletions
17
collapsible.js
Normal file
17
collapsible.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
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');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Add table
Reference in a new issue