1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-17 22:45:54 +02:00

MDL-70634 h5p: minimizing height glitch

This commit is contained in:
Ferran Recio 2021-01-22 16:43:54 +01:00
parent fd840ab59c
commit bc8f4118ac

@ -18,6 +18,9 @@
@template core_h5p/h5pembed
This template will render the embed code shown in the H5P content embed popup.
H5P implements iframe autoheight but if the content is not available it does
not work and we need ensure a minimum height using javascript. Otherwise the user
will not see the error.
Variables required for this template:
* embedurl - The URL with the H5P file to embed
@ -30,5 +33,12 @@
}}
<iframe src="{{embedurl}}" name="h5player" width=":w" height=":h"
allowfullscreen="allowfullscreen" class="h5p-player w-100 border-0"
style="min-height: 230px;">
style="height: 0px;" id="{{uniqid}}-h5player">
</iframe>
{{#js}}
window.onload=function(){
setTimeout(() => {
document.getElementById('{{uniqid}}-h5player').style.minHeight = '230px';
}, 1000);
};
{{/js}}