9. Previous slide 2 -- "Remember to fade out the current slide..."


#1

Hi,

Been stuck on this for a while now, the code is exactly the same as the hint and the remove/add class fading out bit was from the exercise before and worked fine, haven't touched it.

I dont understand why it's not working now, when it is exactly the same as the hint.

The error message is "Oops. Remember to fade out the current slide and remove the "active slide" class"

My code:

$('.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');

});

};

Help meeeeeeeeee :frowning:
sweat:


#2

I'm having the same issue ...


#3

Hi Millie,

Could you please post your entire code?


#4

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

 if(prevSlide.length == 0) {
   prevSlide = $('.slide').last();
 }

 currentSlide.fadeOut(600).removeClass('active-slide');
 prevSlide.fadeIn(600).addClass('active-slide');

});

};

$(document).ready(main);


#5

You need to close the $('.arrow-next').click(...); on line 25 with a closing curly brace (}) and a closing parenthesis ()), like this:

});

#6

OMG yes thank you so much !!!!!


#8

A post was split to a new topic: #9 - Why does it keep telling me to fade out the current slide?


#9