Hello again,

Still having a little trouble with this.  I can get it to scroll, but when I
try to use the cookie value it's always being reset to the last image, and
scrolling there.  Pretty sure I'm doing something wrong with the handlers,
but not sure which I should use.  I've read the documentation, and tried a
few different approaches, but no luck.

I need the carousel to get the cookie value, and scroll to that value.  If
the image is changed by the user (ie next/prev), the cookie needs to be set
to the new value of the visible image (I only have 1 image visible).  The
next time the page is loaded, the carousel should scroll to the new value.

function mapsFIH(carousel, li, idx, state) {
 jQuery('#lcHdr').get(0).innerHTML = "<h1>"+li.title+"</h1>";
 if (state == "init" && $.cookie('map') != null) {
         carousel.scroll($.cookie('map'));
         console.log("scroll to: "+$.cookie('map'));
 }
 if (state == "next" || state == "prev") {
   mapsCookie(carousel, li, idx, state);
 }
};

function mapsCookie(carousel, li, idx, state) {
        $.cookie('map', idx);
        console.log("set cookie: "+$.cookie('map'));
};

$(function() {
 jQuery('#maps').jcarousel({
  itemVisible:1,
  itemScroll:1,
  scrollAnimation:0,
  wrap:true,
  wrapPrev:true,
  itemFirstInHandler:mapsFIH,
 });
});


Just an idea, but maybe you could add this feature to the next version -
remember:[true/false] - configuring the carousel to automatically scroll to
the last viewed/focused image.  Think it would be a great feature, and would
look really nice with scrollAnimation.

Adam
-- 
View this message in context: 
http://www.nabble.com/Starting-image-tf2668575.html#a7618972
Sent from the jCarousel mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to