Skip to content

Instantly share code, notes, and snippets.

@mandrasch
Created April 14, 2019 17:28
Show Gist options
  • Save mandrasch/821d8b7b474977a018206403f584699c to your computer and use it in GitHub Desktop.
Save mandrasch/821d8b7b474977a018206403f584699c to your computer and use it in GitHub Desktop.
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