Prev Slide 2


#1

This is the code I have published...keeps telling me to fade out current slide and remove 'active-slide' class

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();
next = $('.dot').first();
}

currentSlide.fadeOut(600).removeclass('active-slide');
nextSlide.fadeIn(600).addClass('active-slide');
currentDot.removeClass('active-dot');
nextDot.addClass('active-dot');
});

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

});

};

$(document).ready(main);


#2

Hello @francobaresi13,

in your if statement: if (prevSlide.length == 0) also implement the code for prevDot and see if that makes a change. Also implement Dot code in the same way e.g.

 var currentDot = //Implement this!

#3

bartholomewallen - appreciate the help. Sadly, nothing has changed, I'm still getting the same response.


#4

Read my edited comment, @francobaresi13


#5

Awesome, thank you so much


#6

You're very welcome @francobaresi13, keep coding hard :smile:!

Also, remember to close this post by adding one of my replies as a solution so that other helpers know that it is closed.


#7

@bartholomewallen still not working on the task it should be. The Next task is fine, then no.11 comes up with a similar error