richardscarrott / jquery-ui-carousel

jQuery RS Carousel is a responsive and touch-enabled carousel written on top of jQuery and the jQuery UI Widget Factory providing a full and familiar API in less than 2.6kB minified and gzipped.
http://richardscarrott.github.io/jquery-ui-carousel/
192 stars 56 forks source link

Pause button #77

Open ac-bristol opened 10 years ago

ac-bristol commented 10 years ago

Hi there, I'm looking at adding a pause button for the carousel. After extensive UX testing on a site using the carousel, it was determined that a pause button should be present to allow users to stop the auto rotate. Is this functionality already available?

Cheers

richardscarrott commented 10 years ago

Yes and no.

The autoscroll extension has two methods, _stop and _start however they're both private. They're used internally to stop and start the autoscrolling when you hover over the carousel.

I've never had the need to stop the autoscroll but I get it could be useful so I could potentially make them public.

For now however you could call them directly on the instance:

var carousel = $(':rs-carousel').data('carousel');
carousel._stop();
carousel._start();

There's not currently any internal state to maintain whether the carousel is autoscrolling or not so you'd have to maintain that yourself for now.

Feel free to send a pull request and I'll merge it in if you do it otherwise I'll add it in when I get a chance.