Exercise 7, Next Dot 2, can't find the problem


#1

Same issue but can't find what's wrong in the code, here is my code :slightly_smiling:

var main = function() {
    $('.dropdown-toggle').click(function() {
    $('.dropdown-menu').toggle()

});

  $('.arrow-next').click(function() {
    var currentSlide = $('.active-slide');
    var nextSlide = currentSlide.next();
    
     if(nextSlide.length == 0) {
  nextSlide = $('.slide').first();
  nextDot = $('.dot').first();
     }
  
    var currentDot = $('.active-dot').removeClass('active-dot');
    var nextDot = currentDot.next().addClass('active-dot');

    currentSlide.fadeOut(600).removeClass('active-slide');
    nextSlide.fadeIn(600).addClass('active-slide');
    
  });
}

$(document).ready(main);

#2

Hi Petit,

You need to create the currentDot and nextDot variables right by the currentSlide and nextSlide variables at the top of that function, then do stuff with them below rather than what you're currently doing, which is doing stuff with them, creating them, and doing more stuff with them.
Make sense? :slightly_smiling:


#3

Thanks, problem solved :slightly_smiling: