fix: bugs

This commit is contained in:
Cory Dransfeldt 2024-05-23 17:52:08 -07:00
parent 2f9872dc8e
commit 2590fa9e64
No known key found for this signature in database
4 changed files with 18 additions and 8 deletions

View file

@ -1,6 +1,16 @@
window.onload = () => {
const button = document.querySelector('[data-toggle-button]')
const content = document.querySelector('[data-toggle-content]')
const text = document.querySelectorAll('[data-toggle-content] p')
const minHeight = 500 // this needs to match the height set on [data-toggle-content].text-toggle-hidden in text-toggle.css
let interiorHeight = 0
text.forEach(node => interiorHeight += node.scrollHeight)
if (interiorHeight < minHeight) {
content.classList.remove('text-toggle-hidden')
button.style.display = 'none'
}
button.addEventListener('click', () => {
if (content.classList.contains('text-toggle-hidden')) {