diff --git a/xmodule/templates/html/zooming_image.yaml b/xmodule/templates/html/zooming_image.yaml index b91717550b27..00567a2e1708 100644 --- a/xmodule/templates/html/zooming_image.yaml +++ b/xmodule/templates/html/zooming_image.yaml @@ -14,17 +14,39 @@ data: | <img alt="Text for screen readers" src="path to the image you want to display in the unit" /> </a> - <div class="script_placeholder" - data-src="path to the jquery.loupeAndLightbox.js JavaScript file in your course"/> - </div> <script type="text/javascript">// >![CDATA[ - JavascriptLoader.executeModuleScripts($('.zooming-image-place').eq(0), function() { - $('.loupe').loupeAndLightbox({ - width: 350, - height: 350, - lightbox: false + function loadScript(url, callback) { + let script = document.createElement("script"); + script.type = "text/javascript"; + + if (script.readyState) { // IE + script.onreadystatechange = function() { + if (script.readyState === "loaded" || script.readyState === "complete") { + script.onreadystatechange = null; + callback(); + } + }; + } else { // Other browsers + script.onload = function() { + callback(); + }; + } + + script.src = url; + document.head.appendChild(script); + } + + function callback() { + JavascriptLoader.executeModuleScripts($('.zooming-image-place').eq(0), function() { + $('.loupe').loupeAndLightbox({ + width: 350, + height: 350, + lightbox: false + }); }); - }); + } + + loadScript("path to jquery.loupeAndLightbox.js JavaScript file to your course", callback); // ]]></script> <div id="ap_listener_added"></div> @@ -34,24 +56,48 @@ data: |
The example below shows a subset of the biochemical reactions that cells carry out.
You can view the chemical structures of the molecules by clicking on them. The magnified view also lists the enzymes involved in each step.
Press spacebar to open the magnifier.