style: Remove unneeded nesting

2054-player-layout
Georg krause 2023-04-26 14:55:25 +02:00
rodzic 30adbf7c0b
commit 90dddfd86f
1 zmienionych plików z 10 dodań i 10 usunięć

Wyświetl plik

@ -105,17 +105,17 @@ const openMenu = () => {
// little magic to ensure the menu is always visible in the viewport
// By default, try to display it on the right if there is enough room
const menu = dropdown.value.find('.menu')
if (!menu.classList.includes('visible')) {
const viewportOffset = menu.get(0)?.getBoundingClientRect() ?? { right: 0, left: 0 }
const viewportWidth = document.documentElement.clientWidth
const rightOverflow = viewportOffset.right - viewportWidth
const leftOverflow = -viewportOffset.left
if (menu.classList.includes('visible')) return
if (rightOverflow > 0) {
menu.css({ cssText: `left: ${-rightOverflow - 5}px !important;` })
} else if (leftOverflow > 0) {
menu.css({ cssText: `right: -${leftOverflow + 5}px !important;` })
}
const viewportOffset = menu.get(0)?.getBoundingClientRect() ?? { right: 0, left: 0 }
const viewportWidth = document.documentElement.clientWidth
const rightOverflow = viewportOffset.right - viewportWidth
const leftOverflow = -viewportOffset.left
if (rightOverflow > 0) {
menu.css({ cssText: `left: ${-rightOverflow - 5}px !important;` })
} else if (leftOverflow > 0) {
menu.css({ cssText: `right: -${leftOverflow + 5}px !important;` })
}
}
</script>