#94 fixed dropdown menu placement in small window

This commit is contained in:
Jan Prochazka 2021-04-24 11:53:13 +02:00
parent 1e4c108f6f
commit c30724c5da

View File

@ -16,9 +16,17 @@
if (offset.left + width > window.innerWidth) { if (offset.left + width > window.innerWidth) {
newLeft = offset.left - width; newLeft = offset.left - width;
if (newLeft < 0) newLeft = 0;
} }
if (offset.top + height > window.innerHeight) { if (offset.top + height > window.innerHeight) {
newTop = offset.top - height; newTop = offset.top - height;
if (newTop < 0) newTop = 0;
if (newTop + height > window.innerHeight) {
element.style.height = `${window.innerHeight - newTop}px`;
}
} }
if (newLeft != null) element.style.left = `${newLeft}px`; if (newLeft != null) element.style.left = `${newLeft}px`;
@ -115,6 +123,7 @@
z-index: 1050; z-index: 1050;
cursor: default; cursor: default;
white-space: nowrap; white-space: nowrap;
overflow-y: auto;
} }
.keyText { .keyText {