Hi,

As the title says, i want to set the starting position of the jcarousel
according to the last page visited.

What I've done so far is to decompose the last url with*
document.referrer*and then process this String in order to set a value
of a variable named
*startingPosition*. Finally, in the *start* property of the configuration
hash i set start: startingPosition.

The problem is that this is somehow a "slow" solution, since when I load the
page where the carousel is, it starts by default in position 1, and then
after the client does the algorithm of calculating the new position it then
sets the starting point of the carousel where it should be. It's less than a
second, but it does look bad, enough for not implementing it if I don't find
a faster solution without jumps.

Please send me any ideas or suggestions. Don't consider me a pro with
Javascript or Jquery please.

Thanks.

PS: I add the code I'm using right now (I'm adding it in the
jquery.jcarousel.js file):

   // Splits document.referrer
    var reference = document.referrer.split('/');

    // Initialize startingPosition to 1
    var startingPosition = 1;

    // Array with test I'm looking for in the referrer to select the
starting position of the carousel
    var listOfStringsImLookinFor = new Array();
    listOfStringsImLookinFor[0] = "text1";
    listOfStringsImLookinFor[1] = "text2";
    listOfStringsImLookinFor[2] = "text3";
    listOfStringsImLookinFor[3] = "text4";

    // Calculates starting position
    for(var i = 0; i < listOfStringsImLookinFor.length; i++)
        for(var j = 0; j < reference.length; j++)
            if(reference[j] == listOfStringsImLookinFor[i])
                startingPosition = i + 1;

and then down in the carousel configuration: (hash defaults)

     start: startingPosition,


---------- Forwarded message ----------
From: Jose P. Carballo <[EMAIL PROTECTED]>
Date: 2008/10/5
Subject: About JCarousel
To: [EMAIL PROTECTED]


Hello, first of all thanks for this software and all documentation etc. Good
job.

I have a small question, how could I change the image displaying in the
carrousel with html internal links or something.

My carrousel displays one image at a time, let's say I move until image 8,
and then i click on it and i go to another link in my site. When returnin to
the page where the carousel is in, I would want the carousel to be
positioned back on the image 8. So that if I want to check image 9 i dont
have to scroll 8 times.

Thanks!

-- 
Jose Pablo Carballo



-- 
Jose Pablo Carballo

Reply via email to