Next Slide 1 code doesn't work


#1



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


My code does not go through when I check it. It was weird at first because I was fairly certain my code is right, but even when I copy and paste the code from the help box, i STILL get an error.

Here's the error : "Oops, try again. Remember to fade out the current slide and remove the 'activeSlide' class."

Even the error message is wrong. activeSlide isn't even a class. active-slide is a class.


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


#2

@florodude,

Do you have a
$(document).ready(main);
with which you execute the =main= function ???

The structure of the =main= function should look like

var main = function() {
     //Begin of =main= FUNCTION-BODY
        $('.dropdown-toggle').click(function(){
              $('.dropdown-menu').toggle();
        });

        $('.arrow-next').click( function() {
             //code which gets executed when =click=ed
        });
     //End of =main= FUNCTION-BODY
};

And the =main= function should be executed when the document is fully loaded and READY

$(document).ready( main );

#3

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