Exercise 5 - what's wrong with this code?


#1

Hi there I'm getting syntax error under my preview window , SyntaxError: Unexpected token ')'
Also getting the OOPS!!!
Oops, try again. Remember to fade out the current slide and remove the 'active-slide' class.

I have be3nn racking my brains for a while with this one, and would love a some help please.

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

$('.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');
nextSlide.fadeIn(600).addClass('active-slide');

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

});
}

$(document).ready(main);


5. Code not Working
#2

Hi Ashley,

You need to close your if statement with a closing curly brace (}) before that list line shown :slightly_smiling: