More theme - Collapsing the course descriptions

Re: More theme - Collapsing the course descriptions

por James B. Byrne -
Número de respuestas: 0

Thanks.  I sorted this out (with the help of google of course).

For anyone interested this is what you can do:


Step 1. Add the following javascript to:

Before BODY is closed additionalhtmlfooter

<script type="text/javascript">
<!--
    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
//-->
</script>
This could probably go into the:  Within HEAD additionalhtmlhead section instead.

Step 2.  Enclose the variable portion of your course description like this:
<p>A course to prepare for whatever</p>
<a href="#" onclick="toggle_visibility('foo');">See more. . .</a>
<div id="foo"  style='display:none;>
<p>More text than we can comfortably display. . .</p>
<p>Several paragraphs in fact</p>
<p>Mind the div closing tag goes at the end.</p>
</div>

Gives this:
Guest access requires password

A course to prepare for whatever

See more. . .

And that is all there is to it.  Click on 'See more. . .' to display the hidden text and again to hide it. 

Of course, this might be the brute force way of doing things.  If there is some sort of setting or other builtin way to accomplish this then I would like to know.  We are presently using Moodle-2.8.