Modals: lock background scroll; comment dropdown keeps row on one line, full tone labels, flip up near bottom
This commit is contained in:
@@ -47,7 +47,7 @@ function csRow(text, tone) {
|
||||
var sel = document.createElement('select');
|
||||
sel.className = 'input cs-tone';
|
||||
sel.title = 'Тональность комментария';
|
||||
[['positive', '+ позитив'], ['negative', '— негатив'], ['neutral', '○ нейтрал']].forEach(function (o) {
|
||||
[['positive', '+ позитивный'], ['negative', '— негативный'], ['neutral', '○ нейтральный']].forEach(function (o) {
|
||||
var op = document.createElement('option');
|
||||
op.value = o[0];
|
||||
op.textContent = o[1];
|
||||
@@ -152,8 +152,22 @@ function attachCommentAutocomplete(input) {
|
||||
});
|
||||
list.hidden = false;
|
||||
active = -1;
|
||||
positionList();
|
||||
}
|
||||
|
||||
/* Если снизу внутри модалки мало места — раскрываем список вверх, чтобы он не обрезался. */
|
||||
function positionList() {
|
||||
var wrap = input.parentNode;
|
||||
var scrollParent = input.closest('.modal-body') || document.documentElement;
|
||||
var wr = wrap.getBoundingClientRect();
|
||||
var sr = scrollParent.getBoundingClientRect();
|
||||
var below = sr.bottom - wr.bottom;
|
||||
var above = wr.top - sr.top;
|
||||
list.classList.toggle('drop-up', below < 220 && above > below);
|
||||
}
|
||||
|
||||
window.addEventListener('resize', function () { if (!list.hidden) positionList(); });
|
||||
|
||||
function load() {
|
||||
clearTimeout(AC_TIMER);
|
||||
AC_TIMER = setTimeout(function () {
|
||||
|
||||
Reference in New Issue
Block a user