-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
49 lines (44 loc) · 1.39 KB
/
Copy pathscript.js
File metadata and controls
49 lines (44 loc) · 1.39 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
47
48
49
// Handles loading the events for <model-viewer>'s slotted progress bar
const onProgress = (event) => {
const progressBar = event.target.querySelector('.progress-bar');
const updatingBar = event.target.querySelector('.update-bar');
updatingBar.style.width = `${event.detail.totalProgress * 100}%`;
if (event.detail.totalProgress === 1) {
progressBar.classList.add('hide');
} else {
progressBar.classList.remove('hide');
if (event.detail.totalProgress === 0) {
event.target.querySelector('.center-pre-prompt').classList.add('hide');
}
}
};
document.querySelector('model-viewer').addEventListener('progress', onProgress);
function myFunction() {
var x = document.getElementById("myTopnav");
if (x.className === "topnav") {
x.className += " responsive";
} else {
x.className = "topnav";
}
}
function setupModal(id){
var modal = document.getElementById(id+"Modal");
var btn = document.getElementById(id+"Btn");
var closeBtn = document.getElementById(id+"ModalClose");
if(btn && closeBtn){
btn.onclick = function() {
modal.style.display = "block";
}
closeBtn.onclick = function() {
modal.style.display = "none";
}
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal ) {
modal.style.display = "none";
}
}
}
setupModal('print');
setupModal('demo');