summaryrefslogtreecommitdiff
path: root/p/scripts/main.js
diff options
context:
space:
mode:
authorGravatar Inverle <inverle@proton.me> 2025-12-21 15:37:23 +0100
committerGravatar GitHub <noreply@github.com> 2025-12-21 15:37:23 +0100
commit672411ca7053345634a63dd3eabed75baf93043f (patch)
tree59a975e05d49154450f41bf13b7b6042b954c4d6 /p/scripts/main.js
parentf387abe2c4b6668cb507ba2377f8b141e5818ca9 (diff)
Fix dropdown menus in sidebar going under the navigation bar (#8336)
Missed in #8335 because I was testing without having the navigation bar enabled. <img width="674" height="198" alt="image" src="https://github.com/user-attachments/assets/a1db7f95-f1d9-47e5-a572-20892e6c7abc" />
Diffstat (limited to 'p/scripts/main.js')
-rw-r--r--p/scripts/main.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 0cdc4d387..3b47beb84 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -1112,9 +1112,10 @@ function init_column_categories() {
window.addEventListener('hashchange', () => {
const dropdownBottom = dropdownMenu.getBoundingClientRect().bottom;
const toggleHeight = a.getBoundingClientRect().height;
+ const navbarHeight = document.querySelector('nav#nav_entries')?.getBoundingClientRect()?.height || 0;
// If there is no space to display the dropdown below, display it above
- if (dropdownBottom > window.innerHeight) {
+ if (dropdownBottom > window.innerHeight - navbarHeight) {
dropdownMenu.style.bottom = `${toggleHeight + 2}px`;
dropdownMenu.classList.add('arrow-bottom');
}