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.
+13
-5
@@ -210,11 +210,19 @@
|
||||
e.stopPropagation();
|
||||
const btn = document.getElementById('uh-btn');
|
||||
const rect = btn.getBoundingClientRect();
|
||||
drop.style.top = (rect.bottom + 6) + 'px';
|
||||
drop.style.left = rect.left + 'px';
|
||||
// Keep within viewport
|
||||
const rightEdge = rect.left + 176;
|
||||
if (rightEdge > window.innerWidth - 8) drop.style.left = (window.innerWidth - 184) + 'px';
|
||||
drop.style.top = (rect.bottom + 6) + 'px';
|
||||
if (window.innerWidth < 640) {
|
||||
// Mobile: full width below header, no overlap possible
|
||||
drop.style.left = '8px';
|
||||
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');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user