iFrame height resize on Drupal 7


How to use the H5P iframe resizer (h5p-resizer.js) when manually embedding a H5P content on a page using Drupal 7 (Question set) ?

This works: Created a views block and it shows the interactive content on a page and height of the iframe resizes nicely.

This way the height resizing does not work: When created a block on a page, and put only this one line in it:
<iframe src="https://www.mydomain.com/h5p/embed/6308" scrolling="no" marginheight="0" marginwidth="0"  frameborder="0" style="width:100%;"></iframe>

So should I give this iframe a certain ID or attach the .js on the same page or do something to the embed.php file, tried all but nothing works. 

(The reason why I want to create H5P iframes using blocks in Drupal, is that I could not find any other way to load the H5P content (Js and css) only after user clicks a link on a page.) 

fnoks's picture

You say the H5P content should be loaded after the user clicks a link. Does that mean it is hidden initially, or are you loading via ajax?