How do I prepend items to a jCarousel carousel?
I have a carousel using the jCarousel plugin.
I would like to dynamically add 5 new images to a carousel containing 10.
That is easy enough with the carousel.add
method inside a for
loop.
The only issue is, it adds these 5 new items to the end of the carousel list, where I would like to add them to the beginning of the carousel list!
I can't see that jCarousel supports this — and can't seem to figure out how to add items to the beginning of a carousel list without resetting the c开发者_如何学编程arousel altogether (I was hoping this wasn't the answer).
Thanks (:
If you put a negative integer in the add method it should prepend it.
Example: carousel.add(-1,html);
You can edit its library jcarousel.min.js at line no. 16 column no. 5441 . just replace before to after .
SOme line of code is here.
{e<=0?this.list.prepend(b):j.before(b);
精彩评论