5. Code not Working


Hey, everybody!

So, I've been working on the code for exercise 5, "Next Slide 2."

This code:

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


    if (nextSlide.length === 0) {
    nextSlide = $('.slide').first();



just doesn't want to work!

The only error I get is:
Oops, try again. When on the last slide, it looks like the next arrow isn't wrapping back to the first slide. Look back at the instructions and check the code inside the if statement.

Any help is appreciated. :slightly_smiling:


Hi Anika,

These two lines need to come after your if statement :slightly_smiling:


A post was split to a new topic: Exercise 5 - what's wrong with this code?