I've been working a bit with the jCarouselLite plugin, adding a few features as I've needed them. I just put my version on GitHub if you'd like to give it a whirl:

http://github.com/kswedberg/jquery-carousel-lite/fast_forward

There is a "pause" option for the carousel that will automatically pause it on mouseenter and resume it on mouseleave. But if you want to manually pause/resume based on some other interaction (such as clicking a pause button), you can use the following:

$(document).trigger('pauseCarousel');

and

$(document).trigger('resumeCarousel');

You can find out the state of the carousel by doing something like this (replacing "yourcarouselselector" with the actual selector you used for initiating the carousel):

if ( $('yourcarouselselector').data('paused') == false) {
  $(document).trigger('pauseCarousel');
} else {
  $(document).trigger('resumeCarousel');
}


Hope that helps.



--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Oct 4, 2009, at 3:32 PM, Macsig wrote:


Any ideas at all?
I'm really stuck on this.

THANKS FOR YOU HELP. I appreciate it.


Sig

On Oct 3, 6:08 pm, Macsig <sigbac...@gmail.com> wrote:
Update:
on jquery website I found something that could help me to achieve the
stopping/restarting effect I need, here the code

div.hover(
            function() {
                clearInterval(autoScroll);
            },
            function() {
                autoScroll = setInterval(function() {
                    go(curr+o.scroll);
                    }, o.auto+o.speed);
            }
        );

the code above is a patch to put into jcarousellite file and let you
stop/restart the carousel when the mouse if over the containing div.
However I would like to have 2 buttons and press them to stop/restart
the animation and if possible I'd like to keep this functionality
outside the plugin itself. So I'd like to have 2 functions running
when the buttons are pressed but I don't know how (if it is possible)
I can refer to the carousel. Here my idea

$('#stop_button').click(function () {
   XXX.clearInterval(autoScroll);

});

$('#restart_button').click(function () {
   XXX.autoScroll = setInterval(function() {
                    go(curr+o.scroll);
                    }, o.auto+o.speed);
            }

});

but I don't know what to put instead XXX. Any ideas?

Thanks and have  a nice day!

Sig

On Oct 2, 8:35 pm, macsig <sigbac...@gmail.com> wrote:



Hello guys,
Is there a way to stop a carousel (created with jcarosellite 1.0.1)
when it has ben set up with auto-scrolling?
I need to be able to stop it and restart it when a button is pressed.

If I can't can you please suggest me a plugin that have infinite
scrolling, auto-scrolling and I can stop/restart?

Thanks and have a nice day.

Sig

Reply via email to