How can I configure CourseArc content to appear more seamless in Moodle?

Modified on Fri, 23 Aug, 2019 at 8:12 AM

With the help of your Moodle administrator, you can make CourseArc content appear more seamless and size appropriately within Moodle by adding a snippet of Javascript to your theme. 

  1. Make sure you have administrator access to Moodle, or contact your administrator to continue.
     
  2. In Moodle, navigate to Site Administration > Appearance > Additional HTML.

  3. In the Before BODY is closed field, paste the following code:

<script type="text/javascript">
window.addEventListener('message', function(e) {
  if (typeof e.data === "string") { 
    var message = JSON.parse(e.data);
  } else if (typeof e.data === "object") { 
    var message = e.data
  }
  if (typeof message === "object") { 
    if (message.subject == 'lti.frameResize') {
      var height = message.height;
      if (height <= 0) height = 1;
      document.getElementById('contentframe').style.height = height + 'px';
    }
    if (message.subject == 'lti.scrollToTop') {
      document.body.scrollTop = document.documentElement.scrollTop = 0;
    }
  }
});
</script>
  1. Click the Save changes button to update the code. 


Note: These instructions were tested in Moodle 3.1 and may vary slightly for your version of Moodle.  


screenshot of Moodle Administration page under "Additional HTML"

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article