-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
28 lines (25 loc) · 806 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// JS to handle the collapsible summary section
const showMoreBtnHandler = (event) => {
const container = document.getElementById('summary-container');
const fade = document.getElementById('summary-fade');
const btn = document.getElementById('show-more-btn');
if (container.classList.contains('expanded')) {
container.classList.remove('expanded');
fade.style.display = 'block';
btn.textContent = 'Show More';
} else {
container.classList.add('expanded');
fade.style.display = 'none';
btn.textContent = 'Show Less';
}
};
const addShowMoreBtnHandler = () => {
const elBtn = document.getElementById('show-more-btn');
if (elBtn) {
elBtn.addEventListener('click', showMoreBtnHandler);
}
};
const init = () => {
addShowMoreBtnHandler();
};
window.onload = init;