website-risg/output/app.js
2024-02-17 16:27:15 +01:00

18 lines
547 B
JavaScript

document.addEventListener('DOMContentLoaded', function() {
toggleSummary();
});
function toggleSummary() {
const openBtn = document.querySelector('.open-js');
const closeBtn = document.querySelector('.close-js');
const detailElements = document.querySelectorAll('details');
openBtn.addEventListener('click', function(){
detailElements.forEach((detail) => detail.setAttribute("open", ""));
});
closeBtn.addEventListener('click', function(){
detailElements.forEach((detail) => detail.removeAttribute("open", ""));
});
}