probably a better solution than using a timeout
This commit is contained in:
parent
529b9bb482
commit
21b7386a94
1 changed files with 11 additions and 10 deletions
|
@ -290,16 +290,6 @@ const Logic = {
|
|||
}
|
||||
});
|
||||
document.querySelector(this.getPanelSelector(this._panels[panel])).classList.remove("hide");
|
||||
window.setTimeout(function () {
|
||||
//sometimes this executes before the window is there and window.innerWidth returns undefined
|
||||
const difference = window.innerWidth - document.body.offsetWidth;
|
||||
if (difference > 2) {
|
||||
//if popup is in the overflow menu, window will be larger than 300px
|
||||
const root = document.documentElement;
|
||||
root.style.setProperty("--overflow-size", difference + "px");
|
||||
root.style.setProperty("--icon-fit", "12");
|
||||
}
|
||||
}, 200);
|
||||
},
|
||||
|
||||
showPreviousPanel() {
|
||||
|
@ -1154,3 +1144,14 @@ Logic.registerPanel(P_CONTAINERS_ACHIEVEMENT, {
|
|||
});
|
||||
|
||||
Logic.init();
|
||||
|
||||
window.addEventListener("resize", function () {
|
||||
//for overflow menu
|
||||
const difference = window.innerWidth - document.body.offsetWidth;
|
||||
if (difference > 2) {
|
||||
//if popup is in the overflow menu, window will be larger than 300px
|
||||
const root = document.documentElement;
|
||||
root.style.setProperty("--overflow-size", difference + "px");
|
||||
root.style.setProperty("--icon-fit", "12");
|
||||
}
|
||||
});
|
Loading…
Add table
Reference in a new issue