sefg
This commit is contained in:
parent
a0e03efeef
commit
ce4ffd9c02
@ -51,6 +51,11 @@ document.querySelectorAll(".qm-slot").forEach((slot) => {
|
|||||||
const popup = document.getElementById(id);
|
const popup = document.getElementById(id);
|
||||||
if (!popup) return;
|
if (!popup) return;
|
||||||
|
|
||||||
|
// Popup zurück zur Mitte setzen
|
||||||
|
popup.style.transform = "translate(-50%, -50%) scale(1)";
|
||||||
|
popup.style.left = "50%";
|
||||||
|
popup.style.top = "50%";
|
||||||
|
|
||||||
overlay.classList.add("active");
|
overlay.classList.add("active");
|
||||||
popup.classList.add("active");
|
popup.classList.add("active");
|
||||||
|
|
||||||
@ -60,6 +65,52 @@ document.querySelectorAll(".qm-slot").forEach((slot) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* ================================
|
||||||
|
Quick Menu – Popups verschiebbar
|
||||||
|
================================ */
|
||||||
|
|
||||||
|
document.querySelectorAll(".qm-popup").forEach((popup) => {
|
||||||
|
const header = popup.querySelector(".qm-popup-header");
|
||||||
|
if (!header) return;
|
||||||
|
|
||||||
|
let isDragging = false;
|
||||||
|
let startX, startY, startLeft, startTop;
|
||||||
|
|
||||||
|
header.style.cursor = "grab";
|
||||||
|
|
||||||
|
header.addEventListener("mousedown", (e) => {
|
||||||
|
if (e.target.classList.contains("qm-popup-close")) return;
|
||||||
|
|
||||||
|
isDragging = true;
|
||||||
|
header.style.cursor = "grabbing";
|
||||||
|
|
||||||
|
const rect = popup.getBoundingClientRect();
|
||||||
|
startX = e.clientX;
|
||||||
|
startY = e.clientY;
|
||||||
|
startLeft = rect.left;
|
||||||
|
startTop = rect.top;
|
||||||
|
|
||||||
|
// transform zurücksetzen auf konkrete px-Werte
|
||||||
|
popup.style.transform = "none";
|
||||||
|
popup.style.left = startLeft + "px";
|
||||||
|
popup.style.top = startTop + "px";
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("mousemove", (e) => {
|
||||||
|
if (!isDragging) return;
|
||||||
|
popup.style.left = (startLeft + (e.clientX - startX)) + "px";
|
||||||
|
popup.style.top = (startTop + (e.clientY - startY)) + "px";
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("mouseup", () => {
|
||||||
|
if (!isDragging) return;
|
||||||
|
isDragging = false;
|
||||||
|
header.style.cursor = "grab";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/* ================================
|
/* ================================
|
||||||
Quick Menu – Popups schließen
|
Quick Menu – Popups schließen
|
||||||
================================ */
|
================================ */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user