Просмотр исходного кода

Push the popout menus to the left side on narrow screens

master
Fen Dweller 4 лет назад
Родитель
Сommit
84fb4d38a2
1 измененных файлов: 15 добавлений и 0 удалений
  1. +15
    -0
      macrovision.js

+ 15
- 0
macrovision.js Просмотреть файл

@@ -2898,8 +2898,16 @@ document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll(".popout-menu").forEach(menu => menu.classList.remove("visible"));
const rect = e.target.getBoundingClientRect();
popoutMenu.classList.add("visible");

popoutMenu.style.left = rect.x + rect.width + 10 + "px";
popoutMenu.style.top = rect.y + rect.height + 10 + "px";

let menuWidth = popoutMenu.getBoundingClientRect().width;
let screenWidth = window.innerWidth;

if (menuWidth * 1.5 > screenWidth) {
popoutMenu.style.left = 25 + "px";
}
}
e.stopPropagation();
});
@@ -2923,6 +2931,13 @@ document.addEventListener("DOMContentLoaded", () => {
popoutMenu.classList.add("visible");
popoutMenu.style.left = rect.x + rect.width + 10 + "px";
popoutMenu.style.top = rect.y + rect.height + 10 + "px";
let menuWidth = popoutMenu.getBoundingClientRect().width;
let screenWidth = window.innerWidth;

if (menuWidth * 1.5 > screenWidth) {
popoutMenu.style.left = 25 + "px";
}
}
e.stopPropagation();
});


Загрузка…
Отмена
Сохранить