-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
23 lines (23 loc) · 826 Bytes
/
script.js
File metadata and controls
23 lines (23 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(() => {
const btn = document.getElementById('expandBtn');
const section = document.getElementById('expandSection');
const container = document.getElementById('expandBtnContainer');
const handleClick = () => {
if (container.classList.contains('ebc')) {
section.style.height = `${section.scrollHeight}px`;
section.classList.remove('ec');
container.classList.add('ebo');
container.classList.remove('ebc');
setTimeout(() => section.style.height = 'auto', 350);
} else {
section.style.height = `${section.scrollHeight}px`;
setTimeout(() => {
section.style.height = 'auto';
section.classList.add('ec');
}, 0);
container.classList.add('ebc');
container.classList.remove('ebo');
}
};
btn.addEventListener('click', handleClick);
})();