djplaner / Content-Interface-Tweak

Improves both the task of creating content for Blackboard Learn, and reading that content.
https://djplaner.github.io/Content-Interface-Tweak/
GNU General Public License v3.0
0 stars 0 forks source link

Problem with h5p element display on accordion open #5

Closed djplaner closed 5 years ago

djplaner commented 5 years ago

I've set up an example in my sandpit site. I believe you can access that. You should also be able to access the Word document via this OneDrive link.

Current status

The following suggests that the accordion code and the h5p code aren't playing nicely when a new accordion is opened. Have found this thread on h5p.org that suggests a possible solution. I'll explore this and see what I can do.

Problem re-created

If you visit the example you can see the problem re-created if you open up the second accordion.

Minor difference

Though you might see a minor difference. At least I do, when I open the second accordion I see the bottom part of the h5p element. i.e. the following

If I click on one of the reuse, rights of use, or embed elements the element expands.

It's the first viewed accordion element as well, not just the first

It's not widely known but the content interface supports linking directly to one of the accordions. i.e. if you visit this link to the example, it should open the 3rd accordion. (The link is the same as the original, but with #3 added to the end)

When I use this link, the h5p element in the 3rd accordion opens correctly. If I then open the first accordion I see nothing. The second accordion and I see the same error as above.

If I use a link straight to the second accordion, that h5p element is displayed correctly. But the others don't work.

djplaner commented 5 years ago

Progress

Trigger resize don't work

Advice on this page to insert jQuery(window).trigger('resize'); on accordion activate doesn't work.

this suggestions amending H5P as an object - but that doesn't work. Need to figure out how its declared

But it points to these instructions that explicitly touch on this problem but offers the same solution. Comments seem to suggest that the problem is embedding via iframe from another site - which is what we're doing.

Ahh, but replacing the trigger with window.dispatchEvent(new Event('resize')); appears to work