|
|
|
@ -203,13 +203,13 @@ function animateElementsSequentially(index = 0) { |
|
|
|
const relativePercentage = (percentage / maxPercentage) * 100 |
|
|
|
const calculatedHeight = (relativePercentage / 100) * containerHeight |
|
|
|
|
|
|
|
const computedStyle = window.getComputedStyle(bar) |
|
|
|
const minHeight = parseInt(computedStyle.minHeight) || 0 |
|
|
|
const minHeight = getNaturalHeight(bar) |
|
|
|
|
|
|
|
let finalMinHeight = minHeight |
|
|
|
if (bar.querySelector('.explanation')) { |
|
|
|
finalMinHeight = Math.max(minHeight, 160) |
|
|
|
} |
|
|
|
|
|
|
|
// if (bar.querySelector('.explanation')) {
|
|
|
|
// finalMinHeight = Math.max(minHeight, 160)
|
|
|
|
// }
|
|
|
|
|
|
|
|
targetHeights[i] = Math.max(calculatedHeight, finalMinHeight) |
|
|
|
}) |
|
|
|
@ -541,4 +541,42 @@ function typeWriterConsoleSequential(container, options = {}) { |
|
|
|
|
|
|
|
get isActive() { return isActive } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function getNaturalHeight(el) { |
|
|
|
// Save original inline styles
|
|
|
|
|
|
|
|
const prevParent = { |
|
|
|
display: el.style.display, |
|
|
|
visibility: el.style.visibility |
|
|
|
}; |
|
|
|
|
|
|
|
// Apply temporary styles to parent
|
|
|
|
el.style.display = "flex"; |
|
|
|
|
|
|
|
// Also handle hidden children
|
|
|
|
const childPrev = []; |
|
|
|
for (let child of el.children) { |
|
|
|
childPrev.push({ |
|
|
|
display: child.style.display, |
|
|
|
visibility: child.style.visibility, |
|
|
|
position: child.style.position |
|
|
|
}); |
|
|
|
|
|
|
|
child.style.display = "block"; // let CSS decide
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Measure
|
|
|
|
const height = el.scrollHeight; |
|
|
|
|
|
|
|
// Restore child styles
|
|
|
|
Array.from(el.children).forEach((child, i) => { |
|
|
|
Object.assign(child.style, childPrev[i]); |
|
|
|
}); |
|
|
|
|
|
|
|
// Restore parent styles
|
|
|
|
Object.assign(el.style, prevParent); |
|
|
|
|
|
|
|
return height; |
|
|
|
} |