Need help on "Previous Slide 1" (ex. 8)


#1

I am having the same issue, but I don’t have the dot in my add and remove class. Any ideas?

('.arrow-prev').click(function() { var currentSlide = (’.active-slide’);
var prevSlide = currentSlide.prev();

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

Help with 8. Previous slide 1
#2

Hey Jenny,

Could you please post your entire app.js code for us?
Thanks :slight_smile:


#3

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();
    }
    
    if(nextDot.length ==0) {
        nextDot=$('.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();
    
    currentSlide.fadeOut(600).removeClass('active-slide');
    prevSlide.fadeIn(600).addClass('active-class');
});

};
$(document).ready(main);


#4

Never mind – I figured it out.

I had prevSlide.fadeIn(600).addClass(‘active-class’); instead of prevSlide.fadeIn(600)addClass(‘active-slide’);


#5

@coresolver02702 No, that’s actually incorrect syntax. The original code is correct, except you need to add the class active-slide, not active-class :slight_smile: