Skip to content

Commit

Permalink
MDL-70634 h5p: minimizing height glitch
Browse files Browse the repository at this point in the history
  • Loading branch information
ferranrecio committed Jan 25, 2021
1 parent fd840ab commit bc8f411
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion h5p/templates/h5pembed.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}}

0 comments on commit bc8f411

Please sign in to comment.