diff --git a/app/static/js/ascroll.js b/app/static/js/ascroll.js index 8f02a34..b69620e 100644 --- a/app/static/js/ascroll.js +++ b/app/static/js/ascroll.js @@ -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 diff --git a/app/static/js/pandora-scroll.js b/app/static/js/pandora-scroll.js index 3892b98..3ddab24 100644 --- a/app/static/js/pandora-scroll.js +++ b/app/static/js/pandora-scroll.js @@ -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'; + } }