-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
25 lines (24 loc) · 1006 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
document.addEventListener('DOMContentLoaded', function() {
/* Buttons that toggle information */
let toggle_buttons = document.querySelectorAll('.toggle_button');
let toggle_info = document.querySelectorAll('.toggle_information');
/* Hide the information for now */
toggle_info.forEach(function(toggle_info) {
toggle_info.style.display = 'none';
});
/* Text asking for suggestions; hide it at first, if it exists */
let suggestions = document.querySelector('#suggestions');
if (suggestions) {
suggestions.style.display = 'none';
}
/* When a button is clicked, show the information */
toggle_buttons.forEach(function(toggle_button) {
toggle_button.onclick = function() {
toggle_button.nextElementSibling.style.display = 'block';
if (suggestions) {
suggestions.style.display = 'block';
suggestions.innerHTML = 'Any suggestions? Do just contact me!';
}
};
});
});