Improve global open/close functions in main.js
This commit is contained in:
parent
281d6fe055
commit
ae3bf47019
1 changed files with 13 additions and 8 deletions
|
@ -17,25 +17,30 @@ function _resizeIframe(obj, desth) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function openClose(theID) {
|
function openClose(theID) {
|
||||||
if (document.getElementById(theID).style.display == "block") {
|
var el = document.getElementById(theID);
|
||||||
document.getElementById(theID).style.display = "none"
|
if (el) {
|
||||||
} else {
|
if (window.getComputedStyle(el).display === "none") {
|
||||||
document.getElementById(theID).style.display = "block"
|
openMenu(theID);
|
||||||
|
} else {
|
||||||
|
closeMenu(theID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function openMenu(theID) {
|
function openMenu(theID) {
|
||||||
var el = document.getElementById(theID);
|
var el = document.getElementById(theID);
|
||||||
|
|
||||||
if (el) {
|
if (el) {
|
||||||
el.style.display = "block";
|
if (!el.dataset.display) {
|
||||||
|
el.dataset.display = 'block';
|
||||||
|
}
|
||||||
|
el.style.display = el.dataset.display;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeMenu(theID) {
|
function closeMenu(theID) {
|
||||||
var el = document.getElementById(theID)
|
var el = document.getElementById(theID);
|
||||||
|
|
||||||
if (el) {
|
if (el) {
|
||||||
|
el.dataset.display = window.getComputedStyle(el).display;
|
||||||
el.style.display = "none";
|
el.style.display = "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue