Carousels are a list of content panels that mouse user can cycle through using arrow controls and panel indicator. Usually carousels show only one panel at a time, and they usually have at least one CTA in them. They exist to cram as much content in the valuable "Above The Fold" real estate on websites. Although it is debatable whether "Above The Fold" is as important as people think it is, it is still a solid requirement for a lot of website owners.
Carousels with CTAs
This carousel example use Glider.js, but the instructions will contain information to make carousels accessible for all carousel frameworks. The implementation presented here is based on this excellent article by Alison Walden.
3 Dev Adam
Also known as Turkish Spider-Man, this 1973 is the story of crime boss Spider-Man's battle with law enforcement heros Captain America and El Santo.Learn More
Dünyayı Kurtaran Adam
Two space fighters crash into a desert planet and fights a mysterious Wizard who is enslaving the local population.Learn More about Dünyayı Kurtaran Adam
The story of a cop with an epic mullet and a samuari sword who, along with his cool parner, take on a gang of cocaine smugglers in early '90's Los Angeles.Learn More
A woman is possessed by the legendary South Sea Queen to have revenge on the daughter of a man who stole her snake a hundred years before.Learn More
Example code explanation
Below is the HTML of the above example. Use the dropdown to highlight each of the individual steps that makes the example accessible.
- as an ES6 module using Webpack.
- as a native ES6 module within the browser.
If you haven't done so already, choosing which you should use is obviously a major architectural decision. Here are a few articles that will help you decide:
- Joe Honton discusses that With ES Modules and HTTP/2 You May Not Need Webpack Anymore
- Stack Overflow has a really good thread about Webpack vs ES6 modules as well.
Important Note On The CSS Classes Used In This Module:
This module requires specific CSS class names to be used in order it to work correctly.
These CSS classes begin with
enable-carousel__. Please see the documentation above to see where these CSS classes are inserted.
Using NPM/Webpack to load ES6 Modules:
enable-a11yNPM project. Developers who are using webpack should know how to configure webpack to import the enable modules correctly.
You can use the module like this:
// import the JS module import enableCarousel from '~enable-a11y/js/modules/enable-carousel'; // import the CSS for the module import '~enable-a11y/css/enable-carousel'; // How to initialize the enableCarousel library enableCarousel.init(); // Note that this component doesn't currently work when
// new components are added after page load.
Note: If you want to have the skip links like in the example above, please ensure you also include the NPM module for skip links as well.
Alternatively, if you are using LESS you can include the styles in your project's CSS using:
Using ES6 modules natively.
This is the method that this page you are reading now loads the scripts.
- Grab the source by either using NPM, grabbing a ZIP file or cloning the enable source code from github.
If you want to load the module as a native ES6 module, copy
css/enable-carousel.cssfrom the repo and put them in the appropriate directories in your project (all JS files must be in the same directory).
Load the CSS in the head of you document:
<html> <head> ... <link rel="stylesheet" href="path-to/css/enable-carousel.css" > ... </head> <body> ... </body> </html>
Load your scripts using:
<script type="module"> import enableCarousel from "path-to/enable-carousel.js" enableCarousel.init(); </script>
js/modules/es4directory instead of the