-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paths.js
More file actions
46 lines (46 loc) · 1.37 KB
/
s.js
File metadata and controls
46 lines (46 loc) · 1.37 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
let nav;
let modalDialog;
function bodyLoad(){
nav = document.getElementById('nav');
modalDialog = document.getElementById('modal-dialog');
}
function hideAllContents(){
var elements = document.getElementsByClassName('content');
for(e of elements) {
e.style.display = 'none';
}
}
function navClick(){
// hide all contents
nav.style.display = 'none';
hideAllContents();
// scroll up
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}
function contentCheck(id){
// A single method to show element "content_" + button pressed id
const content = document.getElementById('content_' + id)
if (content.style.display === 'none'){
content.style.display = 'block';
nav.style.display = 'block';
} else {
content.style.display = 'none';
var visibleBoxes = 0;
// if all content class divs are hidden, hide nav
var elements = document.getElementsByClassName('content');
for(e of elements) {
if (e.style.display !== 'none'){
visibleBoxes += 1;
}
}
if (visibleBoxes == 0){
nav.style.display = 'none';
}
}
}
function enlargeMe(img) {
// img.style.width = "700px";
modalDialog.showModal();
modalDialog.querySelector('img').src = img.src;
}