Skip to content

Commit

Permalink
fix position popup and default
Browse files Browse the repository at this point in the history
  • Loading branch information
Dufgui committed Apr 16, 2024
1 parent 3bffc29 commit d5e30ce
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions addon/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down Expand Up @@ -172,7 +172,6 @@ function initButton(sfHost, inInspector) {
}
localStorage.setItem("popupArrowOrientation", popupArrowOrientation);
localStorage.setItem("popupArrowPosition", popupArrowPosition);
popupArrowPosition = popupArrowPosition + "%";
updateButtonCSSPropertiesIfNeeded(rootEl, btn, popupEl, popupArrowOrientation, popupArrowPosition);

}
Expand Down

0 comments on commit d5e30ce

Please sign in to comment.