Without styling, the WordPress carousel we've built in the first part of this tutorial is just a list of items, but it is at least useful, in the sense that they're all visible. The CSS we added in part two of this tutorial enhanced the display of the carousel, but now the problem is that only the first item is shown to the user and there's no way to display the rest of the items.
We added arrows to our carousel, to allow the user to navigate between the different items, and now it's time to make them usable, with a bit of JavaScript.
In the continuation of this tutorial, we'll learn how to properly include our script, then we'll write a script that will launch a function which animates the items when the user hits an arrow.
Linking a JavaScript File
Here we'll use JavaScript to make our arrows useful. As for the CSS part, create a new file. I called it carousel.js
and placed it in the root of the plugin's folder.
We need to indicate to WordPress that we are using the JavaScript file. To do this, we'll use the wp_enqueue_script()
function.
Continue reading %Building a WordPress Carousel Plugin: Part 3%
by Jérémy Heleine via SitePoint
No comments:
Post a Comment