mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2025-01-15 19:23:58 +01:00
Optimized for mobile
This commit is contained in:
parent
d1bbecd71b
commit
120465b46a
@ -17,4 +17,4 @@
|
||||
/* Sicherstellen, dass der Übergang smooth ist */
|
||||
.dropdown-menu {
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
}
|
@ -70,6 +70,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
}
|
||||
|
||||
function isSmallScreen() {
|
||||
return window.innerWidth < 992; // Bootstrap-Breakpoint für 'lg'
|
||||
}
|
||||
|
||||
function adjustMenuPosition(submenu, parent, isTopLevel) {
|
||||
const rect = submenu.getBoundingClientRect();
|
||||
const parentRect = parent.getBoundingClientRect();
|
||||
@ -85,8 +89,13 @@ function adjustMenuPosition(submenu, parent, isTopLevel) {
|
||||
submenu.style.right = '';
|
||||
|
||||
if (isTopLevel) {
|
||||
if (isSmallScreen && spaceBelow < spaceAbove) {
|
||||
// Für kleine Bildschirme: Menü direkt über dem Eltern-Element öffnen
|
||||
submenu.style.top = 'auto';
|
||||
submenu.style.bottom = `${parentRect.height}px`; // Direkt über dem Eltern-Element
|
||||
}
|
||||
// Top-Level-Menü
|
||||
if (spaceBelow < spaceAbove) {
|
||||
else if (spaceBelow < spaceAbove) {
|
||||
submenu.style.bottom = `${window.innerHeight - parentRect.bottom - parentRect.height}px`;
|
||||
submenu.style.top = 'auto';
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user