Next dot 2


#1



https://www.codecademy.com/courses/web-beginner-en-seyrq/0/7?content_from=make-an-interactive-website%3Ajquery-effects


it says check your code , the dots are not wrapping after the last slide.


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();
            }
            currentSlide.fadeOut(600).removeClass('active-slide');
            nextSlide.fadeIn(600).addClass('active-slide');
            var currentDot = $('.active-dot');
            var nextDot = currentDot.next();
            currentDot.removeClass('active-dot');
            nextDot.addClass('active-dot');
        });
    
}

$(document).ready(main);


#2

@coderdesigner123
You will want to define the following variables before the IF statement

            var currentDot = $('.active-dot');
            var nextDot = currentDot.next();

#3

Thanks, it worked !!