Place mobile modal above button
This commit is contained in:
10
script.js
10
script.js
@@ -52,8 +52,13 @@ const positionPrivacyFlyover = (trigger) => {
|
||||
const panelHeight = privacyFlyoverPanel.offsetHeight;
|
||||
|
||||
if (isMobile) {
|
||||
privacyFlyover.style.removeProperty("--privacy-flyover-top");
|
||||
privacyFlyover.style.removeProperty("--privacy-flyover-left");
|
||||
const panelWidth = window.innerWidth - 40;
|
||||
const left = 20;
|
||||
const top = Math.max(gap, rect.top - panelHeight - gap);
|
||||
|
||||
privacyFlyover.style.setProperty("--privacy-flyover-left", `${left}px`);
|
||||
privacyFlyover.style.setProperty("--privacy-flyover-top", `${top}px`);
|
||||
privacyFlyover.style.setProperty("--privacy-flyover-width", `${panelWidth}px`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,6 +71,7 @@ const positionPrivacyFlyover = (trigger) => {
|
||||
|
||||
privacyFlyover.style.setProperty("--privacy-flyover-left", `${left}px`);
|
||||
privacyFlyover.style.setProperty("--privacy-flyover-top", `${top}px`);
|
||||
privacyFlyover.style.removeProperty("--privacy-flyover-width");
|
||||
};
|
||||
|
||||
const closeFlyover = () => {
|
||||
|
||||
Reference in New Issue
Block a user