Skip to content

Commit

Permalink
use a ResizeObserver to resize the element
Browse files Browse the repository at this point in the history
  • Loading branch information
VictoriqueMoe committed Oct 19, 2023
1 parent 2d3e575 commit cd84e34
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/public/assets/custom/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ Site.loadPage(async function (site) {
});
((() => {
const cardBody = document.getElementById("resultsCardBody");
const resizeListener = new ResizeObserver(entries => {
const formCardBodyObserver = entries[0];
const formCardBodyOffsetHeight = formCardBodyObserver.target.offsetHeight;
cardBody.style.maxHeight = `${formCardBodyOffsetHeight}px`;
});
const formCardBody = document.getElementById("formCardBody");
['load', 'resize'].forEach(evt =>
window.addEventListener(evt, () => {
const cardFormBodyHeight = formCardBody.offsetHeight;
cardBody.style.maxHeight = `${cardFormBodyHeight}px`;
}, true)
);
resizeListener.observe(formCardBody);
})());
const distributableRadios = document.querySelectorAll("#authorYes,#authorNo");
if (distributableRadios) {
Expand Down

0 comments on commit cd84e34

Please sign in to comment.