add js to hide/show page contents
This commit is contained in:
parent
eeff471c96
commit
2b8fdf669d
23
hidepage.js
Normal file
23
hidepage.js
Normal file
@ -0,0 +1,23 @@
|
||||
function hide_page() {
|
||||
// to unhide the hidden element, we also need to un-ID it
|
||||
// to make the CSS rule stop applying
|
||||
// janky hack, but it makes it not have 1 frame of showing on load.
|
||||
hidden.id = '';
|
||||
hidden.style.display = '';
|
||||
shown.style.display = 'none';
|
||||
}
|
||||
|
||||
function unhide_page() {
|
||||
shown.style.display = '';
|
||||
hidden.style.display = 'none';
|
||||
}
|
||||
|
||||
var shown = document.getElementById("page-content");
|
||||
var hidden = document.getElementById("page-content-hidden");
|
||||
|
||||
document
|
||||
.getElementById("button-hide-page")
|
||||
.addEventListener("click", hide_page);
|
||||
document
|
||||
.getElementById("button-unhide-page")
|
||||
.addEventListener("click", unhide_page);
|
Loading…
x
Reference in New Issue
Block a user