From 3deaf17aa93afd9f22148817e004dd2ba0fe085e Mon Sep 17 00:00:00 2001 From: "Michael K. Avanessian" Date: Sat, 6 Apr 2024 00:17:12 -0700 Subject: [PATCH] Minor placement adjustment to expand control element --- VERSION | 2 +- upcoming-media-card.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index b4a2fb2..c889c81 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.3 +0.5.4 diff --git a/upcoming-media-card.js b/upcoming-media-card.js index e226c30..5edb3be 100644 --- a/upcoming-media-card.js +++ b/upcoming-media-card.js @@ -885,21 +885,21 @@ class UpcomingMediaCard extends HTMLElement { border-radius: 50%; `; const setExpandControlPosition = () => { + let verticalOffset = 57; if (!this.content.children[this.collapse - 1]) { let placeholderExists = controlContainer.querySelector('.placeholder'); + expandControl.style.position = 'absolute'; if (placeholderExists) { - expandControl.style.marginTop = '9px'; - expandControl.style.marginRight = '1px'; - } else { - expandControl.style.marginTop = '0px'; + expandControl.style.top = '42px'; } + expandControl.style.right = '1px'; } else { let targetItem = this.content.children[this.collapse - 1]; - let nextItem = this.content.children[this.collapse]; - let targetRect = targetItem.getBoundingClientRect(); let containerRect = this.content.getBoundingClientRect(); - let verticalOffset = 46; // Adjust this value to change the vertical position of the expand control when placeholder is not present - expandControl.style.marginTop = `calc(${targetRect.bottom - containerRect.top + (nextItem ? 10 : 0) + verticalOffset}px)`; + let targetRect = targetItem.getBoundingClientRect(); + expandControl.style.position = 'absolute'; + expandControl.style.top = `${targetRect.bottom - containerRect.top + verticalOffset}px`; + expandControl.style.right = '1px'; } }; setTimeout(setExpandControlPosition, 0);