Help please! What is wrong with this code?/ Next slide 1


#1



PLS help! I do not know where the problem is. It gives an error:
Make sure you have defined all the variables!

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


#2

Hi this line

var currentslide =$('.active-slide');

you wrote currentslide instead of currentSlide


#3

Thank you, but it still does not work. It gives an error as Remember to fade out the current slide and remove the 'activeSlide' class.


#4

can you post your new code ?


#5

Sure.

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


#6

it's because you change that

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

And

that it's the one frome your first post

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

#7

Thank you!! :slight_smile:


#8

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.