-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
executable file
·27 lines (22 loc) · 982 Bytes
/
script.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
document.addEventListener('DOMContentLoaded', function () {
var btn = document.querySelector('.toggle-button');
var content = document.querySelector('.content');
var icon = btn.querySelector('i');
btn.addEventListener('click', function () {
var isExpanded = content.style.display === 'block';
content.style.display = isExpanded ? 'none' : 'block';
icon.classList.toggle('fa-caret-right', isExpanded);
icon.classList.toggle('fa-caret-down', !isExpanded);
});
});
document.addEventListener('DOMContentLoaded', function () {
var btn = document.querySelector('.toggle-button1');
var content = document.querySelector('.content1');
var icon = btn.querySelector('i');
btn.addEventListener('click', function () {
var isExpanded = content.style.display === 'block';
content.style.display = isExpanded ? 'none' : 'block';
icon.classList.toggle('fa-caret-right', isExpanded);
icon.classList.toggle('fa-caret-down', !isExpanded);
});
});