update height on display

This commit is contained in:
j 2022-09-26 22:03:59 +01:00
parent f39f854821
commit 0746a2ab6c
2 changed files with 17 additions and 0 deletions

View file

@ -141,6 +141,11 @@ function formatInfo(config, ascroll) {
}
title.onclick = event => {
section.style.display = section.style.display == "none" ? "block" : "none"
if (section.style.display == "block") {
section.querySelectorAll("pandora-scroll").forEach(ps => {
ps.updateAnnotationHeight()
})
}
div.querySelectorAll("h3.toggle").forEach(other => {
if (other != title) {
var osection = other.nextElementSibling

View file

@ -29,6 +29,18 @@ class PandoraScroll extends HTMLElement {
video.muted = true
})
}
this.updateAnnotationHeight = function() {
var height = 0
var text = shadow.querySelector('.text')
text.querySelectorAll('.annotation.single').forEach(annotation => {
var rect = annotation.getBoundingClientRect()
console.log(annotation, rect.height)
if (rect.height > height) {
height = rect.height
}
})
text.style.height = height + 'px';
}
}