My code is the exact same as the exemplar code, but when I submit it it says, "Remember to fade out the current slide and remove the 'activeSlide' class."


#1

I can't figure out why it's not working. I'm on 4. Next Slide 1
Does anyone know what could be wrong?
This is my code:
var main = function() {
$('.dropdown-toggle').click(function() {
$('.dropdown-menu').toggle();
});
$('.arrow-next').click(function() {
var currentSlide = $('.active slide');
var nextSlide = currentSlide.next();
currentSlide.fadeOut(600).removeClass('active-slide');
nextSlide.fadeIn(600).addClass('active-slide');
});
}
$(document).ready(main)


#2

I am getting the exact same thing.


#3

Hi Tyler,

You've got one really small error, it took me a while to find it :)
$('.active slide') needs to be $('.active-slide').


#4

Hey there, I have the same error message, but I have the hyphens in place

var main = function() {

$('.dropdown-toggle').click( function() {
$('.dropdown-menu').toggle();
});

$('.arrow-next').click( function() {
var currentSlide = $('.active-slide');
var nextSlide = currentSlide.next();

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

});

};

$(document).ready(main);


#5

I found the issue

The .removeClass() and .addClass() at the end should be adding/removing 'active-slide' not '.active-slide'

Can anyone explain why you include the "." from CSS in the selector but not in the method?


#6

@askrahn That question gets asked a lot :slightly_smiling: I'd put up a FAQ topic in this category, but until I can find more than one question that belongs there I'm just going to have to link to my other answers on a subject.
Anyway, here's an answer to your question :slightly_smiling::