9. Previous slide 2


#1

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

I've Quadruple checked this and I cant seem to find where I have gone wrong....this current lesson was about adding one line. and every one before has been approved....I don't quite understand, sorry for all the problems I have been having!


#2

Hi Kyle,

It looks to me like you forgot to close your $('.arrow-next').click(...); before the $('.arrow-prev').click(...); :)
Try adding a closing curly brace (}) along with a closing parenthesis ()) right before the $('.arrow-prev').click(function() { line:

$('.arrow-next').click(function() {
  // ...
}); // ← you're missing that line

$('.arrow-prev').click(function) {
  // ...
});

#3

I myself been having so many problems with this section


#4

@868guy Learning to code is hard! Feel free to ask for help in our forums when you get stuck :)


#5

I will because I am a Graphic Designer looking to transition into the world of code because I love the challenge :grinning: