From d5e30cee5d7ba8ec4d78f4f91ec96b5afcf1ef8d Mon Sep 17 00:00:00 2001 From: Guillaume Dufour Date: Tue, 16 Apr 2024 15:40:53 +0200 Subject: [PATCH] fix position popup and default --- addon/button.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addon/button.js b/addon/button.js index 8a4b25c1..ab3222f5 100644 --- a/addon/button.js +++ b/addon/button.js @@ -83,14 +83,14 @@ function initButton(sfHost, inInspector) { function updateButtonCSSPropertiesFromStorage(rootElement, buttonElement, popupEl) { let popupArrowOrientation = iFrameLocalStorage.popupArrowOrientation ? iFrameLocalStorage.popupArrowOrientation : "vertical"; - let popupArrowPosition = iFrameLocalStorage.popupArrowPosition ? (iFrameLocalStorage.popupArrowPosition + "%") : "122px"; + let popupArrowPosition = iFrameLocalStorage.popupArrowPosition ? (iFrameLocalStorage.popupArrowPosition) : "15"; updateButtonCSSPropertiesIfNeeded(rootElement, buttonElement, popupEl, popupArrowOrientation, popupArrowPosition); } function updateButtonCSSPropertiesIfNeeded(rootElement, buttonElement, popupEl, popupArrowOrientation, popupArrowPosition) { if (popupArrowOrientation == "vertical") { - rootElement.style.top = popupArrowPosition; + rootElement.style.top = popupArrowPosition + "%"; popupEl.classList.remove("insext-popup-horizontal"); popupEl.classList.remove("insext-popup-horizontal-left"); @@ -115,7 +115,7 @@ function initButton(sfHost, inInspector) { } } else { // horizontal - rootElement.style.right = popupArrowPosition; + rootElement.style.right = popupArrowPosition + "%"; if (popupArrowPosition < 8) { popupEl.classList.add("insext-popup-horizontal-left"); @@ -172,7 +172,6 @@ function initButton(sfHost, inInspector) { } localStorage.setItem("popupArrowOrientation", popupArrowOrientation); localStorage.setItem("popupArrowPosition", popupArrowPosition); - popupArrowPosition = popupArrowPosition + "%"; updateButtonCSSPropertiesIfNeeded(rootEl, btn, popupEl, popupArrowOrientation, popupArrowPosition); }