There are many plugins for WordPress that allow you to enhance the appearance of your post and pages with tabs, accordions, lightboxes and similar elements that reveal content selectively. If you want to use H5P content inside these elements, the H5P content may not be displayed however.
This issue may be caused by giving the content that’s hidden the height of 0 pixels – so the H5P content is there, but it’s invisible. When you switch tabs, open an accordion element, etc. and then expect the content to show up, H5P would have to be informed that there’s more space now and that it should resize. Unfortunately, the other plugin would have to tell H5P, and it’s quite understandable if other plugin developers don’t want to have some extra rule for one arbitrary other plugin like H5P – what if other plugins come along that need some special treatment for themselves?
There’s a workaround that I created in my free time. It’s a separate plugin. Using it and its source code is absolutely free. I don’t want any money from you. However, if you like this plugin, I kindly ask you to make a one-time donation of 2.50 EUR to the Rainforest Coalition — or more if you can afford to.
What does the plugin do?
The plugin is just a workaround. It tells H5P content to resize regularly in a time interval that you can set instead of the other plugin telling H5P to resize once it should. You can easily guess that this is not a perfect solution. H5P will be told to resize way more often than it needs to, and H5P content may be displayed with a slight delay that’s defined by the time interval. It defaults to half a second. You cannot make the interval too small however, because then H5P would be told to resize too often, and the user’s browser might stall. Oh, and of course the plugin will not solve the H5P-not-being-displayed issue if it’s caused by something else.
How to get the plugin?
The plugin is called SNORDIAN’s H5P Resize Pulse. You can install it via the official WordPress plugin repository or download it from my github repository. The source code is openly licensed, so feel free to remix and repurpose it.
Oh, and please don’t forget: If you like this plugin, I kindly ask you to make a one-time donation of 2.50 EUR to the Rainforest Coalition — or more if you can afford to.