Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
H5P dialog cards hide image until turnover
/*
1. insert via https://de.wordpress.org/plugins/custom-css-js/ plugin
2. change post-id number (can be found in source code of wordpress)
3. maybe change iframe id
4. enjoy! ;-)
See: https://h5p.org/node/70099
*/
jQuery(document).ready(function($) {
/*console.log('custom js loaded - 17');*/
/* inject css to first iframe, change postid for page */
if (jQuery("body.postid-13").length > 0) {
$('#h5p-iframe-1').on('load', function() {
/*console.log('activate eduhack for h5p - show image only after turnover');*/
var iFrameHead = jQuery("#h5p-iframe-1").contents().find("head");
/*console.log('iframe head', iFrameHead);*/
jQuery("<style type='text/css'> .h5p-dialogcards-image-wrapper img{display:none;} .h5p-dialogcards-turned img{display:block !important;} </style>").appendTo(iFrameHead);
}); /* eo iframe load */
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.