v1.8.35: dropdown full-width on mobile — no overlap possible
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+12
-4
@@ -211,10 +211,18 @@
|
|||||||
const btn = document.getElementById('uh-btn');
|
const btn = document.getElementById('uh-btn');
|
||||||
const rect = btn.getBoundingClientRect();
|
const rect = btn.getBoundingClientRect();
|
||||||
drop.style.top = (rect.bottom + 6) + 'px';
|
drop.style.top = (rect.bottom + 6) + 'px';
|
||||||
drop.style.left = rect.left + 'px';
|
if (window.innerWidth < 640) {
|
||||||
// Keep within viewport
|
// Mobile: full width below header, no overlap possible
|
||||||
const rightEdge = rect.left + 176;
|
drop.style.left = '8px';
|
||||||
if (rightEdge > window.innerWidth - 8) drop.style.left = (window.innerWidth - 184) + 'px';
|
drop.style.right = '8px';
|
||||||
|
drop.style.width = 'auto';
|
||||||
|
} else {
|
||||||
|
// Desktop: align to button
|
||||||
|
drop.style.right = 'auto';
|
||||||
|
drop.style.width = '11rem';
|
||||||
|
const left = Math.max(8, Math.min(rect.left, window.innerWidth - 184));
|
||||||
|
drop.style.left = left + 'px';
|
||||||
|
}
|
||||||
drop.classList.toggle('hidden');
|
drop.classList.toggle('hidden');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user