7. Next dot2


#1



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


Can't understand what's wrong. Have checked other topics, seams everything is allright(

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

        
    }

    $(document).ready(main);


#2

Hi @danikfedirko,

You need to put your if statement before you change the current dot and slide :slight_smile: