-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpcontainer.js
50 lines (43 loc) · 1.45 KB
/
helpcontainer.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const helpContainerDOM = document.createElement('div');
export let helpContainerOpen = false;
export function createHelpContainer(parentContainer){
helpContainerDOM.setAttribute('id','helpContainer');
helpContainerDOM.setAttribute('style','overflow-y: scroll');
helpContainerDOM.innerHTML = `
<div class=help-wrapper">
<div class="help-heading">
<h2>RaZ Three.js Boilerplate</h2>
<button id="help-close-button">X</button>
</div>
<div class="content">
<p>This is the helpContainer, can be used for information, menus, forms, etc.</p>
</div>
</div>
`;
parentContainer.appendChild(helpContainerDOM);
document.getElementById('help-close-button').addEventListener("click", hideHelp);
return helpContainerDOM;
}
export function hideHelp(){
helpContainerDOM.style.opacity = 0;
helpContainerDOM.style.pointerEvents = "none";
helpContainerOpen = false;
}
export function showHelp(){
helpContainerDOM.style.opacity = "1";
helpContainerDOM.style.pointerEvents = "auto";
helpContainerOpen = true;
}
export function showIframe(src){
helpContainerDOM.innerHTML = `
<div class="help-wrapper">
<div class="help-heading">
<h2></h2>
<button id="help-close-button">X</button>
</div>
<iframe src="${src}" style="border:none;height:100vh;width:100%;"></iframe>
</div>
`
showHelp();
document.getElementById('help-close-button').addEventListener("click", hideHelp);
}