Reputation: 68650
I'm using a lightweight jQuery plugin for carousel, it works great except that it doesn't support circular carousel, i.e it'll auto-slide 1,2,3,4 and then backwards 4,3,2,1 instead of 1,2,3,4 then again jumping back to 1,2,3,4 again, which is what I want.
Here's the jsFiddle for it: http://jsfiddle.net/vLZFh/
I'd really appreciate any help.
Many thanks
Upvotes: 0
Views: 1567
Reputation: 4073
In function setTimer it is decided weather the carousel moves forward or backwards. In the case of forward the function move is called with 1 as value for iDirection, in the other case with value -1. In function move it's only checked if the sum of iDirection and iCurrent produces a valid value. The easiest way to get the effect you want to have is to get rid of bForward in setTimer (but you might as well just ignore that) and to modify function move to jump back to 0 if iCurrent > iSteps, like this:
function move(..) {
iCurrent++;
if (iCurrent >= iSteps) iCurrent = 0;
...
}
Upvotes: 1