kswedberg / jquery-carousel-lite

A jQuery carousel plugin based on jCarouselLite by Ganeshji Marwaha
MIT License
177 stars 59 forks source link

Multiple carousels share controls #4

Closed benmoss closed 13 years ago

benmoss commented 13 years ago

I'm running multiple carousels on a page, each which have their own controls. They all share the same settings though, so they have one shared class ('carousel') and one call from javascript.

https://gist.github.com/887005

When I click on the buttons for the first carousel, the second one also moves. I can envision a case where this might be a desired feature, so maybe this is not something that needs to be fixed, but in my specific use-case it is not. If it were required that the control buttons be in the same div as the carousel it might be simpler, but perhaps there could be some way to tie them to a specific carousel?

benmoss commented 13 years ago

Well 11 minutes later I fixed it myself, not by patching jCarouselLite but by altering the way I called .jCarouselLite().

https://gist.github.com/887005

A little hacky perchance but it gets the job done.

kswedberg commented 13 years ago

Hi Ben,

The btnPrev and btnNext options can take a function. I updated the gist for you here:

https://gist.github.com/888482

Also, IDs can't start with a number, so I prefixed them with "c-".

benmoss commented 13 years ago

Awesome, thanks Karl. I hadn't realized that about HTML ids but you are quite right. Thanks!

On Mar 26, 2011, at 1:59 PM, kswedbergreply@reply.github.com wrote:

Hi Ben,

The btnPrev and btnNext options can take a function. I updated the gist for you here:

https://gist.github.com/888482

Also, IDs can't start with a number, so I prefixed them with "c-".

Reply to this email directly or view it on GitHub: https://github.com/kswedberg/jquery-carousel-lite/issues/4#comment_920767

benmoss commented 13 years ago

While I have your attention, I've been going crazy trying to figure out how to make this work after an Ajax load (using $.get). Using the success callback calls it too soon, and in Webkit browsers the carousel sets the dimensions of the div to 0x0. I've tried everything I can find about binding it to 'load' but nothing seems to work.

kswedberg commented 13 years ago

Hey Ben, Do you have any of the dimensions set with CSS? It would probably help to at least have the container element styled with css -- position relative, overflow hidden, height, width, etc.

I might be able to take a look if you can put together a simple test page. jsfiddle.net works great for that sort of thing.