Previous Slide 1 "Correct" but not working


#1


Previous Slide 1

The module says I've put in the code correctly, however when I attempt to move to the previous slide using the arrow, it doesn't work. I've gone over the code multiple times, is there something I'm missing? Any help would be greatly appreciated!

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 = $('.active-dot').next();
        
        if (nextSlide.length == 0) {
            nextSlide = $('.slide').first();
            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

Follow this pattern in the prev handler.


#3

@gigajumper40301

And have a close look at

fadeout

and

fadein


#4

Thank you both very much, I found my error and fixed it. It ended up being the fadeOut/fadeIn error.


#5

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