Previous slide 2


#1

Okay I was off the sight for awhile but I'm still not sure what I'm doing wrong here,

Here is my code now,

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();
  }
  
    currentSlide.fadeOut(duration).removeClass('active-slide');
    prevSlide.fadeIn(duration).addClass('active-slide');
    });

    $('.arrow-prev').click(function() {
    var currentSlide = $('.active-slide');
    var prevSlide = currentSlide.prev();
    currentSlide.fadeOut(600).removeClass('active-slide');
    prevSlide.fadeIn(600).addClass('active-slide');
    
  });

$(document).ready(main);

I got the error "Oops, try again. Remember to fade in the previous slide and add the 'active-slide' class."

I;m not sure what I need to enter to change the duration in $('arrow-next').


#2

#3

Hi @eragous,

You're closing your main function too early. Move the closing curly brace (}) on line 5 down to just before $(document).ready(main);, and your code should work :slight_smile: