Previous Slide 1 issues


#1

I've redone this code a few times now and it's still not working. This time I'm getting the error "Uncaught TypeError: currentSlide.prev is not a function". Any ideas? Here's my code:

var main = function() {
// Toggles dropdown menu.
$('.dropdown-toggle').click(function() {
$('.dropdown-menu').toggle();
});
// "Next Arrow" 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();
}

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

// Animated dots for the carousel.

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-slide');
});

};

$(document).ready(main);


#2

Hi Dane,

You're missing the dollar sign ($) in front of that :slightly_smiling:


#3

I can't believe I missed that. Thanks!