Carousel Slider

Asked

Viewed 349 times

0

I needed to adjust this script so that when I clicked on the Previous button it returned the command, but when I click both on the next and on the Previous, the slide is progressing in the same way, I thank you from the outset.

CODE JS:

$(document).ready( function() {
    $('#myCarousel').carousel({
        interval:   4000
    });

    var clickEvent = false;
    $('#myCarousel').on('click', '.nav a', function() {
            clickEvent = true;
            $('.nav li').removeClass('active');
            $(this).parent().addClass('active');        
    }).on('slid.bs.carousel', function(e) {
        if(!clickEvent) {
            var count = $('.nav').children().length -1;
            var current = $('.nav li.active');
            current.removeClass('active').next().addClass('active');
            var id = parseInt(current.data('slide-to'));
            if(count == id) {
                $('.nav li').first().addClass('active');    
            }
        }
        clickEvent = false;

    });
});

Next, I will print what is happening, this function is what coordinates for my slide to pass, and a background arises in the options that have on top of my menu, it is as if the links follow the image

This is my slide:

inserir a descrição da imagem aqui

But when I click on the controller to the left, the image goes to the left, but the background in the link, keeps going forward, in the case there, it was in AIR, I clicked to return, and it went to PHENOMENAL, IE, it just goes forward, does not come back. inserir a descrição da imagem aqui This function is the core of my slide, but I need that when I click back it goes back and not forward, how do I do that? I’m kind of layy with jquery..

  • 1

    Hello, Roberto. Welcome to en.stackoverflow. I could display the full code and tell you which version of Jquery is used?

  • 1

    You explained what you need. But what is the question?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.