Next Slide 1


#1

Hello, have some problems

var main = function() {
$('.dropdown-toggle').click(function() {
$('.dropdown-menu').toggle();
});
$('.arrow-next').click(function() {
var currentSlide = $('.active-slide');
var nextSlide = currentSlide.next;
currentSlide.fadeOut(600).removeClass('active-slide');
nextSlide.fadeIn(600).addClass('active-slide');

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

Code passes, but when i try to click arrows error occurs - Uncaught TypeError: nextSlide.fadeIn is not a function


#2

Hi Юрий,

You need a set of parenthesis (()) after next, so that line looks like this:

var nextSlide = currentSlide.next();

:)


#3

Hey Zystvan,

I'm getting the same error, I have included the parenthesis after next, here's my code:

var main = function () {
$('.dropdown-toggle').click(function(){
$('.dropdown-menu').toggle();
});

$('.arrow-next').click(function(){
    var currentSlide = $('.active-slide');
    var nextSlide = $('.active-slide').next();
    currentSlide.fadeOut(600).removeClass('active-slide');
    nextSlide.fadIn(600).addClass('active-slide');
    
    if (nextSlide.length == 0) {
        $('.slide').first();
    }
});

}

$(document).ready(main);

Any idea what the problem is?


#4

@rorygrenade

You need to set something (hint below) equal to that.

Hint

The something should be nextSlide. Like this:

nextSlide = $('.slide').first();