My code doesn't work. I mean I click on prevArrow and nothing happen


#1



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


no errors


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();
        
        if(nextSlide.length == 0) {
            nextSlide = $('.slide').first();
        }
        
        if(nextDot.length == 0) {
            nextDot = $('.dot').first();
        }
        
        currentSlide.fadeOut(600).removeClass('active-slide');
        nextSlide.fadeIn(600).addClass('active-slide');
        
        currentDot.removeClass('active-dot');
        nextDot.addClass('active-dot');
    });
    
    $('.arrow-prev').click(function() {
        var currentSlide = $('.active-slide');
        var prevSlide = currentSlide.prev();
        
        currentSlide.fadeOut(600).removeClass('active-slide');
        prevSlide.fadeIn(600).addClass('active-slide');
    });
};

$(document).ready(main);


#2

@neagumihai54321gmail,

As you have the code now,
you will first have to use the next-slide Arrow 1 or 2 times
and then you will see something happening when you use the prev-slide Arrow....


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.