Almost every single feature of WebSlides is a plugin. The core only consists of methods that allows you to navigate through the slides while the plugins do the rest. They can be overwritten and you are able to create your custom plugins. Just call registerPlugin
(as seen on the API) before creating the instance:
This allows you to rewrite the navigation to use a menu (for example) or add that missing piece of functionality you'd like to see. See this part of the code to see all the plugins we're using.
Here's the list with links to any plugins that have any relevant information:
autoslide
- Autosliding plugin that will autoadvance the slides over the time.
clickNav
- Allows to click on the page to get to the next slide.
grid
- Shows a grid over the page for easy prototyping by pressing ENTER
.
hash
- In charge of updating the hash and reacting to any changes to it.
keyboard
- Handles keyboard shortcuts.
nav
- Shows the navigation on the bottom with the arrows and numbers. And keeps it updated!
scroll
- Allows to navigate with scroll.
touch
- Allows to navigate with touch gestures.
video
- Allows to pause video and autoplay them upon entering the slide.
youtube
- Allows to control YouTube videos.
zoom
- Controls the slides index.
Getting started
When creating a new plugin you can use Classes. Something like this:
The constructor gets the WebSlides instance which allows you to call any of the public methods.
Plugins that affect only some slides
There are times in which you may need to add a feature to only certain slides like we do with videos for example. Since plugins have access to the WebSlides
instance and that has access to the el
which holds all of the slides, the recommended approach is to querySelectorAll
the elements that interest you:
And then use in conjunction with Slide.getSectionFromEl
and the events that the Slides provide: