aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/js/killy/index.js
diff options
context:
space:
mode:
authorGravatar KillyMXI2017-06-17 20:33:07 +0300
committerGravatar KillyMXI2017-06-17 20:33:07 +0300
commit897a351eb36ece8e6f9d2ccd8946ccfe9b7cfeea (patch)
tree21d6de31c1bfe9d948731364d221ea9ff9783a8f /juick-www/src/main/js/killy/index.js
parent1dad7c9928291ed19021b9f118dbe6dd736017ba (diff)
juick-www: fix for zero-height embeds in folded tree
do not resize element before its width is known
Diffstat (limited to 'juick-www/src/main/js/killy/index.js')
-rw-r--r--juick-www/src/main/js/killy/index.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/juick-www/src/main/js/killy/index.js b/juick-www/src/main/js/killy/index.js
index 1a59805d..46798c9f 100644
--- a/juick-www/src/main/js/killy/index.js
+++ b/juick-www/src/main/js/killy/index.js
@@ -40,9 +40,13 @@ function makeResizableToRatio(element, ratio) {
// calcHeight :: Number -> Number -- calculate element height for a given width
function makeResizable(element, calcHeight) {
- const resizeToRatio = el => { el.style.height = (calcHeight(el.offsetWidth)).toFixed(2) + 'px'; };
- window.addEventListener('resize', () => resizeToRatio(element));
- resizeToRatio(element);
+ const setHeight = el => {
+ if (el.offsetWidth > 0) {
+ el.style.height = (calcHeight(el.offsetWidth)).toFixed(2) + 'px';
+ }
+ };
+ window.addEventListener('resize', () => setHeight(element));
+ setHeight(element);
}
function getEmbeddableLinkTypes() {