views_slideshow_cycle sets a function for after and before cycle plugin options that are in charge of updating active class for pager items when a current slide is changed.

So, if someone uses the advanced cycle plugin options this pager functionality is lost. User may add its own code to manage pager, but since I guess it's easier to just call those functions even when user suplies its own after and before code.

Patch attached in short.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tunic’s picture

Status: Active » Needs review
FileSize
10.42 KB

Solved by declaring functions with actual before and after code and calling them before call user code.

See attached patch.

My editor has removed of spaces from blank lines, so you patch has more changes than it should, but I guess it's ok.

juanramonperez’s picture

Status: Needs review » Reviewed & tested by the community

Works for me. Thanks

RogerRogers’s picture

#1 works for me. Thanks!! This is definitely needed, can't use before/after functions and pager without it.

hkirsman’s picture

Version: 7.x-3.0 » 7.x-3.x-dev
FileSize
5.24 KB

#1 works.

Did a new patch for latest version. Also removed forwardFlag from user before and and after functions as pager_after_fn(curr, next, opts) and pager_before_fn(curr, next, opts) do not have fourth parameter.

                 settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
-                  pager_after_fn(currSlideElement, nextSlideElement, options, forwardFlag);
+                  pager_after_fn(currSlideElement, nextSlideElement, options);
                   eval(afterValue);
                 }
                settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
-                  pager_before_fn(currSlideElement, nextSlideElement, options, forwardFlag);
+                  pager_before_fn(currSlideElement, nextSlideElement, options);
                  eval(beforeValue);
                }

Please fix this! Up since November 16, 2011! Took me some time to figure this out.

elBradford’s picture

I can confirm that #4 works on latest dev. PLEASE push this, thank you.

danlinn’s picture

I'll confirm #4 on the latest release again. Would be really nice to have this in at least the dev branch.

jojonaloha’s picture

Status: Reviewed & tested by the community » Needs work

From what I can tell this patch breaks the active pager class being set on initial load and in autoplay. After applying the patch in #4 the active class is only set if I click on a pager item.

danlinn’s picture

Status: Needs work » Needs review
FileSize
5.28 KB

Here's a new patch that fixes a few things: it will now resize slides if needed (context was being lost) and if the before or after function doesn't exist, it will still work properly.

jojonaloha’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm the patch in #8 resolves the issue I was seeing with active pagers.

inky@inky3d.com’s picture

I have also used the patch and it works for me.

What doesn't work, though, is the "pauseOnPagerHover: 1"
I have set this through the views advanced options, and even tried 'hardcoding' it by setting it to 1 on jquery.cycle.all.js (line 1050).

Not sure if this is related, or if I should open a new issue?

raincloud’s picture

After updating views_slideshow_cycle.js as in solution #8, it works ok for me, but with side effects.

If I delete the custom "after" and "before" options (as specified in View->Slideshow->Settings->"jQuery Cycle Custom Options") from my View definition, or if I create a new View with Slideshow, the default Page Counter doesn't change when slide changes. But if those "before" and "after" options are specified in View definition then it's ok.

ermannob’s picture

Patch at #8 works for me. I had the "active pager" problem with a "before" advanced setting. Didn't notice any drawbacks yet.

Thanks.

wangqizhong’s picture

Status: Reviewed & tested by the community » Fixed

Thanks a lot to tunic, hkirsman, danlinn and everyone else for the great work on the patches, testing, reviews and reporting.

It's more time this got committed and I went ahead and had this rolled at:

7.x-3.x: d01c839.

Marking this as fixed.

Please let me know if you would have any other questions, comments, issues or concerns on any of these changes, I would be glad to provide more information.
Thanks again to everyone for the help and great work on this issue.

Cheers!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ergophobe’s picture

Just a note for those who might be stuck on Drupal 6 and having this problem, since this probably won't get backported, you can add something like this to your "after" callback.

       var pagerId = '#' + 'views_slideshow_pager_field_item_bottom_[VIEW-NAME]-[DISPLAY-NAME]_' + opts.currSlide;
       if (!$(pagerId).hasClass('active')) {
          $('.views_slideshow_pager_field_item').removeClass('active');       
          $(pagerId).addClass('active');
       }

Not great - it will have a lag time where the slide shows then a second later the pager catches up, but better than being broken.

Also of course you can get the pagerId some more general way if you want this to apply to all slideshows.