The jCarousel library supports the addition of what it calls "pagination". These are the little numbers or dots that appear below a carousel to allow a user to jump to a specific page in the carousel.

The jCarousel module does not seem to have support for this (despite a misleading description of what the "navigation" option does).

Let's add it. Patch forthcoming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

azinck created an issue. See original summary.

azinck’s picture

Status: Active » Needs review
FileSize
4.67 KB

Here's a first stab.

I'm guessing it won't work too well if you're using the jcarousel views pager plugin or ajax. I don't really know much about those use-cases, but I doubt getting this functionality to work with ajax is an easily solvable problem within the jCarousel framework.

niko-’s picture

Hi @azinck

Sorry for delay with unswer

I think that adding support of "pagination" is great idea
Only one thing is blocker to apply this patch in module.

+++ b/assets/vendor/jcarousel/jcarousel.js
@@ -87,6 +87,22 @@
+                return '<a href="#' + page + '">' + page + '</a>';

We should prevent adding html in js and use twig templates instead

niko-’s picture

Status: Needs review » Needs work
skylord’s picture

Version: 8.x-4.0 » 6.0.0-alpha1
Status: Needs work » Needs review
FileSize
4 KB

Reroll for version 6 and remove adding html in js as plugin defaults are working well.

Rishi Kulshreshtha’s picture

Version: 6.0.0-alpha1 » 6.0.x-dev
Assigned: Unassigned » Rishi Kulshreshtha
Status: Needs review » Needs work
FileSize
34.1 KB

Thanks @skylord; the rerolled patch looks good, but the pagination numbers are vanilla. IMHO we can have a similar approach of using skins here to fix this.

Rishi Kulshreshtha’s picture

Assigned: Rishi Kulshreshtha » Unassigned
Status: Needs work » Needs review
FileSize
34.31 KB
6.81 KB
2.08 KB

Added pagination styling.

firstlut’s picture

Thanks for doing this! It works a charm. I did have to add a "display: flex" to the <p> that contains the pagination dots, as they were stacking up. I've also set up a view with 4 images across, and it's treating every 4 images as one page, instead of creating a dot for each image.

If I knew more JS, I'd figure it out myself, but I'm the worst!