Recalculating this on window resize is possibly unnecessary plus it does not detect changes to the menu’s available width while the window stays the same.
See https://www.woltlab.com/community/thread/302316-men%C3%BCpfeile-bei-zu-vielen-men%C3%BCpunkten-nicht-vorhanden/
function setupOverflow(): void {
_firstElement.addEventListener("transitionend", rebuildVisibility);
- window.addEventListener("resize", () => {
+ const observer = new ResizeObserver(() => {
_firstElement.style.setProperty("margin-left", "0px", "");
_marginLeft = 0;
rebuildVisibility();
});
+ observer.observe(_menu);
enable();
}
*/
function setupOverflow() {
_firstElement.addEventListener("transitionend", rebuildVisibility);
- window.addEventListener("resize", () => {
+ const observer = new ResizeObserver(() => {
_firstElement.style.setProperty("margin-left", "0px", "");
_marginLeft = 0;
rebuildVisibility();
});
+ observer.observe(_menu);
enable();
}
function initOverflowNavigation() {