Stuck...I need help. I noticed others have been stuck here as well. What am I doing wrong?


#1



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


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

  var currentDot = $('.active-dot');
  var prevDot = currentDot.prev();

  if(prevSlide.length == 0) {
    prevSlide = $('.slide').last();
     prevDot = $('.dot').last();
  }

  currentSlide.fadeOut(600).removeClass('active-slide');
  prevSlide.fadeIn(600).addClass('active-slide');

  currentDot.removeClass('active-dot');
  prevDot.addClass('active-dot');
});
    
};

    $(document).ready(main);


#2

Hi you didn't close that function

$('.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();
  }
#its missing the }); here

#3

Im getting this error message

"Oops, try again. Remember to remove '.active-dot' from the current dot. "


#4

Ive even copied and pasted and I still get the same message.


#5

Does your code look like that ?

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();
        }
    }); #its was missing the });
    $('.arrow-prev').click(function() {
        var currentSlide = $('active-slide');
        var prevSlide = currentSlide.prev();

        var currentDot = $('.active-dot');
        var prevDot = currentDot.prev();

        if(prevSlide.length == 0) {
            prevSlide = $('.slide').last();
            prevDot = $('.dot').last();
        }

    currentSlide.fadeOut(600).removeClass('active-slide');
    prevSlide.fadeIn(600).addClass('active-slide');

    currentDot.removeClass('active-dot');
    prevDot.addClass('active-dot');
    });
    
};

$(document).ready(main);

#6

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

var currentDot = $('.active-dot');
var prevDot = currentDot.prev();

if(prevSlide.length == 0) {
prevSlide = $('.slide').last();
prevDot = $('.dot').last();
}

currentSlide.fadeOut(600).removeClass('active-slide');
prevSlide.fadeIn(600).addClass('active-slide');

currentDot.removeClass('active-dot');
prevDot.addClass('active-dot');
});

};

$(document).ready(main);

#7

now you didn't close the if statement

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

    var currentDot = $('.active-dot');
    var nextDot = currentDot.next();

    if(nextSlide.length == 0) {#open the if statement
        nextSlide = $('.slide').first();
        nextDot = $('.dot').first();
    }#close the if statement
});

#8

oh wow. smh...Thanks so Much!!!! It finally worked. thank you thank you!:grinning: