Target audience: Site Administrators, Site Managers, Site Editors
To reduce scrolling, you can add accordions to a page in the Web Management System (WMS). Accordions collapse (hide) select content, allowing the reader to choose which content to expand (reveal).
The use of accordions should be limited to cases where pages contain a lot of content.
In this article:
Accordions are best used on pages where the content can be structured as main headings followed by secondary information that can be expanded on demand. The secondary information is automatically collapsed (i.e., hidden) when a reader first goes to a page; they can expand an accordion by clicking on the main heading. A reader can expand or collapse whatever accordion items they wish.
A collapsed accordion item is indicated by a "+" next to the header. An expanded item is indicated by a "—"
Example: On a page that describes a step-by-step procedure, the names of the steps are displayed as main headings, and the details describing each step are collapsed. In this screenshot, the reader has chosen to expand Step 1 but has left Steps 2-4 collapsed:
Note:
To create an accordion on a WMS page:
This is the source code that the WYSIWYG editor generates when you insert a four-accordion layout into your page:
<div class="accordion">
<h3><a href="#">Title A</a></h3>
<div>
<p>Content A</p>
</div>
<h3><a href="#">Title B</a></h3>
<div>
<p>Content B</p>
</div>
<h3><a href="#">Title C</a></h3>
<div>
<p>Content C</p>
</div>
<h3><a href="#">Title D</a></h3>
<div>
<p>Content D</p>
</div>
</div>
Each accordion item contains two elements:
This is the HTML code for one accordion item:
<h3><a href="#">Title A</a></h3>
<div>
<p>Content A</p>
</div>
Note:
When you insert an accordion, the WYSIWYG editor creates four accordion items by default. These have the placeholder titles of A, B, C, and D.
To add additional accordions to your page:
If you're adding an image to an accordion's content, make sure to keep it inside the <div> tags.
If you want your text to wrap around the image, you need to insert the image at the top of the text and choose either left- or right-alignment from the WYSIWYG editor. Also, make sure the text fully wraps around the image, or add as many line breaks (<br> tags) as you need to cover the height of the image.
Example:
Code for the example accordion illustrated above:
<h3>Step 2 - Create Final Report</h3>
<div>
<p><img style="FLOAT: left" class="imagecache-medium caption0" title=Pyramids alt=Pyramids src="https://www.mcgill.ca/inb/sites/mcgill.ca.inb/files/imagecache/medium/images/pyramid-giza.jpg" caption="Pyramids"> The final report should include: scope statement, work methods, transfer to operations, acceptance criteria, etc. The final report should include: scope statement, work methods, transfer to operations, acceptance criteria, etc. <br><br><br><br></p></div>