I posted this in views carousel weeks ago but have had absolutely no interested responses. I hoping the jcarousel people might be more amenable to it? Basically, I would like the carousel to "remember" where a user was in the carousel and set the start position to that spot. This is useful for me because I have the same carousel which spans multiple pages, but it keeps resetting to the beginning as users navigate.
I actually found all the code needed to implement this but I'm having trouble figuring out where to put it. The problem for me is that there is a dependency on a a jquery plugin. As such, I really don't know where to put the files or how to call them...
The URL for the "remember where I was" plugin for jcarousel is http://blog.devonlinux.net/2009/10/10/remember-jcarousel-position/
This plugin requires cookies. It references an "easy" cookie plugin for jquery which I have linked below:
URL for cookie jquery plugin http://plugins.jquery.com/files/jquery.cookie.js.txt
Could anyone recommend where to put these files and how to call them?
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | jcarousel-936932-13-starting-position.patch | 1.16 KB | mvc |
| #4 | jcarousel-pager-state-936932-4-D6.patch | 1.01 KB | mikeytown2 |
Comments
Comment #1
quicksketchI think that your request is probably out-of-scope for help provided in the issue queue. This will definitely require custom coding to accomplish. The issue queue for jCarousel is focused on bug reports with the module and providing support on how to use the jCarousel end-user features, not a support forum on programming.
Comment #2
ovg commentedA little dirty, but adding the following code (before "// Callbacks need to be converted...") to the jcarousel.js of jcarousel-7.x-2.3-alpha2 solved it for me.
Comment #3
ovg commentedAdding the following code to jcarousel.js (before "// If this carousel...") did it in Drupal 6:
Comment #4
mikeytown2 commentedCode we use in the 2.x branch; it reacts to the page=* url variable.
Comment #5
jjjames commentedSubscribe
Comment #6
francoud commentedI think this behaviour should be a normal feature of the module - using jcarousel to navigate through pages is a great feature, but if it always starts from 1 it's not useful.
The patch in #2 works for me in Drupal 7 - properly adjusting numbers (e.g. i need 4 instead of 8, etc.)
Patch in #4 is maybe a little more elastic.. but it doesn't work in D7 (not for me at least). A D7 version would be great...
Thanks to all for this! :)
Comment #7
jjjames commentedCan't get this to work in D7 using jcarousel 2.6, any suggestions?
Comment #8
mvcthis sort of thing can be done using #1401652: Set the start position based on a CSS selector and some fancy views theming.
Comment #9
marco van bemmel commented#2 Did it for me!!
I work with Drupal 7.15 and jCarousel 2.6.
@jjjames, did you cleaned up the caches after adding the code to jcarousel.js?
Now we have to be very carefull with updates from jCarousel... This code sould be in the core of jCarousel, otherwise it's like closing a book before turning a page. (very anoying)
Thanks ovg!
Comment #10
rphillipsfeynman commentedLike for #6 and #9, it worked for me as well with Drupal 7.15 and jcarousel 7.x-2.6. I agree with #9 it should be part of the code. Thanks a lot to @ovg for this great solution. It is really useful.
Comment #11
mikeytown2 commentedSetting this to needs review as a lot people seem to want this by default.
Comment #12
rankinstudio commentedI can report that #3 works perfectly on D7 as well. Add it just before the
// Callbacks need to be converted from a string to an actual function.
Make sure you don't have a pager on your view! That caught me up.
I tried #2 and #8. #3 centers the active image in the middle of the carousel. Works like a charm.
Example of it working on D7: http://rankinstudio.com/HackberryCanyon
Cheers!
Comment #13
mvchere's #3 as a patch, which works for me on 7.x-2.6. bumping versions because things get fixed first on the most recent version available, then get backported.
[rant]on general principle, it seems wrong for this module to ship with a copy of jcarousel, as opposed to using a copy from libraries/ like views_slideshow_jcarousel and most other modules using jquery do, but then we couldn't hack it up like this. and of course this module will eventually need to be updated for the "completely rewritten" jcarousel 0.3, which is still in beta. the last release of 0.2 was 2011-04-14, so it's entirely possible that Jan Sorgalla has dealt with this issue upstream by now, but i'm not going to check since i don't have time to port this module now to 0.3 anyways. for all these reasons i'm not personally going to mark this patch RTBC, but it works for me, and it'll likely work for you. have fun![/rant]
Comment #14
LaurenW commentedMy carousel shows 5 items at a time and this mostly works for me, except for the first 1-2 items in each set of five which keep defaulting to show the previous set in the carousel on that page. Any ideas how to fix this?