If I supply a custom start position in the style settings, the carousel insists on starting at the first item. I need to investigate this as it seems to work fine when I manually set options.start in the jcarousel JS.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

deviantintegral’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev
deviantintegral’s picture

To clarify this: it looks like the start setting is having an effect, but it's quite inconsistent with the pager behaviour. I'm investigating to see exactly what the issue is.

deviantintegral’s picture

Title: Custom start position from a View doesn't work » Custom start position breaks the carousel navigation pager
  • When you set a custom starting position, the pager indexes are renumbered.
  • On a pager showing 5 items, I set options.start to be 6. I expected this to start on the second set of items in the pager, but instead item 6 is showing as the first item in the carousel.
  • If I click the next arrow, the pager skips from page 1 to page 3 instead of going to page 2.
  • If I reload the page, and click a pager index instead of using the arrows, what becomes active is not what I click on. Instead, it jumps to the corresponding page index as one would have expected without the pager renumbering.
  • If the start position is not an even multiple of the number of items per page, the behaviour is more inconsistent. I'm hoping by addressing the above problems will cause this one to get in line.

So, it looks like the actual issue is that the pager doesn't work well with custom start positions.

deviantintegral’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Active » Needs review

Here's a patch that sets the appropriate pager position when options.start is customized. I've only tested this on 6.x, but this patch applies identically to 7.x, so I'm assuming it will work there. I'll review this on 7.x tomorrow unless someone beats me to it.

quicksketch’s picture

Status: Needs review » Needs work

Looks like d.o ate your patch. Could you re-upload?

deviantintegral’s picture

Status: Needs work » Needs review
FileSize
2.61 KB

Let's try this again.

don ferrando’s picture

Your patch breaks the pager, when options.start is NOT customized. You can replace

  if (start <= carousel.pageSize) {
   var active_page = Math.ceil(start / carousel.pageSize) + 1; 
  }
  else {
    var active_page = Math.ceil(start / carousel.pageSize);
  }

by

var active_page = Math.ceil(start / carousel.pageSize);