Bläddra i källkod

Push the popout menus to the left side on narrow screens

master
Fen Dweller 4 år sedan
förälder
incheckning
84fb4d38a2
1 ändrade filer med 15 tillägg och 0 borttagningar
  1. +15
    -0
      macrovision.js

+ 15
- 0
macrovision.js Visa fil

@@ -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();
});


Laddar…
Avbryt
Spara