Previous slide 2: Oops, try again. Remember to fade out the current slide and remove the 'active-slide' class


#1

Currently stuck on this problem. I keep getting the following error message: Oops, try again. Remember to fade out the current slide and remove the 'active-slide' class.

Any idea what the problem is?

Thanks!


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

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');

});
 };
 $(document).ready(main);

#2

@adilmorrison,
You have pasted-in
your arrow-prev =click= Eventhandler

$('.arrow-prev').click(function(){
 var currentSlide = $('.active-slide');
 var prevSlide = currentSlide.prev();
 if(prevSlide.length == 0) {
     prevSlide = $('.slide').last();
 }
 currentSlide.fadeOut(600).removeClass('active-slide);
 prevSlide.fadeIn(600).addClass('active-slide);

});

into the middle of your
arrow-next =click= Eventhandler

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

 currentDot.removeClass('active-dot');
 nextDot.addClass('active-dot');

});