Table of Contents

2.1.4. Slideshows

Purpose

A slideshow is a scrollable content panel that fits into a small space.

They generally include a system of pagination, navigation arrows, and/or a system for pausing or advancing the content in the case of a slideshow with automatic scrolling.

With regards to accessibility, two types of slideshow can be distinguished:

  1. Slideshows with automatic scrolling.
  2. Slideshows with manual scrolling.

BasicHTML code

An example of the basic HTML code for both types of slideshow is shown below. This code should be modified according to the context, especially with respect to the content of the panels.

<ul id="slideshow">
    <li class="panel" id="panel-1">
        Content of panel 1.
    </li>
    <li class="panel" id="panel-2">
        Content of panel 2.
    </li>
    <li class="panel" id="panel-3">
        Content of panel 3.
    </li>
</ul>

Without JavaScript, all the panels are displayed.

Note

The recommendations to follow when writing the JavaScript code will vary according to whether you require an automatic scrolling slideshow or not.

Behaviour with JavaScript for slideshows with automatic scrolling

The scripts must handle the following points:

The resulting code with JavaScript is as follows:

<button id="pause-play">Pause</button>
 
<ul id="slideshow">
    <li class="panel" id="panel-1">
        Content of panel 1 (hidden) with <a href="#" tabindex="-1">a link</a>.
    </li>
    <li class="active-panel panel" id="panel-2">
        Content of panel 2 with <a href="#">a link</a>.
    </li>
    <li class="panel" id="panel-3">
        Content of panel 3 (hidden) with <button tabindex="-1">a button </button>.
    </li>
</ul>

Note

This code should be modified according to the context, especially if the pause button is an image. You would then need a code similar to this:

<button id="pause-play"><img src="images/pause.png" alt="Pause" /></button>

Warning

The pausing system (in this case, the “Play/Pause” button) must always be inserted in the DOM before the elements it interacts with, whatever its position on the screen.

Behaviour with JavaScript for slideshows with manual scrolling

The scripts must handle the following points:

The resulting code in JavaScript is as follows:

<button id="previous">Previous</button>
 
<ul id="slideshow">
    <li class="panel" id="panel-1">
        Content of panel 1 (hidden).
    </li>
    <li class="active-panel panel" id="panel-2">
        Content of panel 2.
    </li>
    <li class="panel" id="panel-3">
        Content of panel 3 (hidden).
    </li>
</ul>
 
<button id="next">Next</button>

Note

This code should be modified according to the context, especially if the “Previous” and “Next” buttons are images. In this case you need a code similar to the one below:

<code html> <button id=“previous”><img src=“images/previous.png” alt=“Previous” /></button>

[…]

<button id=“next”><img src=“images/next.png” alt=“Next” /></button>

Démonstration

Démonstration à venir.