website-risg/output/app.js

18 lines
547 B
JavaScript
Raw Normal View History

2024-02-17 11:27:54 +01:00
document.addEventListener('DOMContentLoaded', function() {
toggleSummary();
});
function toggleSummary() {
2024-02-17 16:27:15 +01:00
const openBtn = document.querySelector('.open-js');
const closeBtn = document.querySelector('.close-js');
const detailElements = document.querySelectorAll('details');
2024-02-17 11:27:54 +01:00
openBtn.addEventListener('click', function(){
detailElements.forEach((detail) => detail.setAttribute("open", ""));
});
closeBtn.addEventListener('click', function(){
2024-02-17 16:27:15 +01:00
detailElements.forEach((detail) => detail.removeAttribute("open", ""));
2024-02-17 11:27:54 +01:00
});
}