Reviewed & tested by the community
Project:
jCarousel
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
11 Jan 2012 at 17:31 UTC
Updated:
10 Dec 2013 at 20:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
deviantintegral commentedHere's a patch that applies to both 6.x and 7.x. I haven't tested it on D7 yet, but will do so shortly.
Comment #2
deviantintegral commentedHere's an additional commit that fixes calculating the starting page when the pager size is set to "Auto".
Comment #3
deviantintegral commentedThere was an issue with scrolling in Chrome. It looks to be running the setupCallback in a separate thread (cool!) so it was getting called after the we needed the pageStart variable it sets up. The attached patch moves the scroll into the setup callback to fix this.
Comment #4
mvcworks as advertised. thanks!
Comment #5
jnettikFirst off thank you so much to @deviantintegral. This saved me a ton of work in figuring this out myself!
I did have trouble with the patch in #3 though in my use case. I'm preprocessing the view output to put my active class on the jcarousel
to:
makes everything work for me. Not sure if if there is a reason against just using .find().
Comment #6
rankinstudio commentedCould someone explain how to use this? Where do I set the active class, how does the script use it? Step by step?
Thanks :)
Comment #7
mvc@rankinstudio: here are the steps:
note however that if you have a carousel of links to nodes and you just want to have the carousel positioned so that the current node is displayed in the carousel on page load, you can use the simpler approach discussed at #936932: Setting jcarousel start position to last position user saw which doesn't require you to add your own css class.
Comment #8
LaurenW commentedCan anyone explain how to add a css class to the active item in your carousel for Drupal 7? #7 offers some code for Drupal 6, but I'm not sure if the code is the same or where to edit the views field template for my image.
Thanks.
Comment #9
mvcthe above code should also work for D7. for general information on views field templates, you could start here:
http://views-help.doc.logrus.com/help/views/using-theme
http://www.flowbyte.com/journal/drupal-7-theming-views-field-templates
Comment #10
LaurenW commentedThanks! I got it working now. It does still load the page with the first set of thumbnails in the carousel and then switches to the active/current one. Any way to load the current one first and not see that flipping?
Thanks
Comment #11
mvc@LaurenW: sorry, but that would take a larger change to the module, and this was good enough for my client, so i stopped here.
Comment #12
mvci'm migrating the site i first used this patch for a year and a half ago to D7, and the patch in #3 still applies cleanly & works perfectly. in fact, in D7 by linking a field in my view display to its original source node i was able to use the css selector a.active and avoid all view preprocessing or template hacking.
@jnettik, your change is necessary if you add a custom class to the jcarousel li tag but i would simply suggest that you put it on something contained in that tag so that the original patch will work for you.
Comment #13
scsmith_calarts commentedIt seems that this patch no longer works with the latest version of jcarousel (v 7.x-2.7).
I get this result:
patching file includes/jcarousel_style_plugin.inc
Hunk #1 succeeded at 22 (offset 1 line).
Hunk #2 FAILED at 137.
1 out of 2 hunks FAILED -- saving rejects to file includes/jcarousel_style_plugin.inc.rej
patching file js/jcarousel.js
Hunk #1 succeeded at 78 (offset 12 lines).
Hunk #2 succeeded at 232 (offset 29 lines).
Hunk #3 succeeded at 242 (offset 29 lines).
patching file js/jcarousel.js
Hunk #1 succeeded at 84 (offset 12 lines).
Hunk #2 succeeded at 97 (offset 12 lines).
patching file js/jcarousel.js
Hunk #1 succeeded at 55 with fuzz 1 (offset 9 lines).
Hunk #2 succeeded at 75 with fuzz 2 (offset 12 lines).
Hunk #3 succeeded at 97 (offset 12 lines).