1

Hi I have jQuery carousel it's playing fine on clicking the next pre buttons, Also i need autoplay, i am not able to add Autoplay, please help me thanks in advance, below is the code.


(function($) {
    $(function() {
        $('.jcarousel').jcarousel();

        $('.jcarousel-control-prev')
            .on('active.jcarouselcontrol', function() {
                $(this).removeClass('inactive');
            })
            .on('inactive.jcarouselcontrol', function() {
                $(this).addClass('inactive');
            })
            .jcarouselControl({
                target: '-=1'
            });

        $('.jcarousel-control-next')
            .on('active.jcarouselcontrol', function() {
                $(this).removeClass('inactive');
            })
            .on('inactive.jcarouselcontrol', function() {
                $(this).addClass('inactive');
            })
            .jcarouselControl({
                target: '+=1'
            });

        $('.jcarousel-pagination')
            .on('active.jcarouselpagination', 'a', function() {
                $(this).addClass('active');
            })
            .on('inactive.jcarouselpagination', 'a', function() {
                $(this).removeClass('active');
            })
            .jcarouselPagination();
    });`enter code here`
})(jQuery);
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
Thaskeen
  • 11
  • 1
  • 1
  • 2

2 Answers2

3

use this after your code:

setInterval("$('.jcarousel').jcarousel('scroll', '+=1')", 1000)

or you can use the Autoscroll Plugin

http://sorgalla.com/jcarousel/docs/plugins/autoscroll/

which is much better solution.

Aladdin
  • 384
  • 1
  • 5
3

you can use the autostart attribute.

$(element_id_or_class).jcarouselAutoscroll({ autostart: true });
MSMOHAN
  • 235
  • 1
  • 11