tinycarousel icon indicating copy to clipboard operation
tinycarousel copied to clipboard

Infinite loop extended

Open subetha opened this issue 10 years ago • 2 comments

For more flexibility I added an option to set the number of items moved. For example you could define the width of the viewport as 4 items wide and move always 4 items at once. The endless loop will now also work if the number of items in the loop is not multiples of 4. To allow for this the cloning had to be extended to double the number of items. I have not tested vertical movement and bullets, but it should work as well with the changes.

With this addition the carousel is quite flexible and still very lightweight.

subetha avatar Mar 08 '15 17:03 subetha

That look really cool!!

Question: I see that there are 2 lines with $overview.append($slides.slice(0, self.slidesTotal).clone().addClass("mirrored")); Is that correct?

wieringen avatar Mar 09 '15 07:03 wieringen

Yes. To make the infinite loop work the items have to be mirrored twice. So i just added the cloning another time. I am sure there is a more elegant solution.

subetha avatar Mar 09 '15 14:03 subetha