theme.js refactoring

the function hide has been refactored to toggleVisibility. The target element id
is now given by a parameter.
This commit is contained in:
Christoph Ladurner
2020-06-15 21:44:38 +02:00
parent 62c52b1c68
commit 3be8708428
2 changed files with 6 additions and 9 deletions

View File

@@ -1,11 +1,8 @@
export function hide() {
var x = document.getElementById('heading');
export function toggleVisibility(id) {
var element = document.getElementById(id);
var isHided = element.style.display === "none";
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
element.style.display = isHided ? "block" : "none";
}
window.hide = hide;
window.toggleVisibility = toggleVisibility;

View File

@@ -125,7 +125,7 @@
</div>
<div class="short-menu-right">
<div class="short-menu-right-h" onclick="hide();">
<div class="short-menu-right-h" onclick="toggleVisibility('heading');">
<i class="fa fa-bars fa-lg"></i><span style="margin-left:3px;">Menu</span>