Previous dot 2: Make sure you have defined all the variables!


#1

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) {
                    var nextSlide = $('.slide').first();   
                }

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

                if(prevSlide.length == 0) {
                    var prevSlide = $('.slide').last();
                    var prevDot = $('.dot').last();
                }

                currentSlide.fadeOut(duration).removeClass('.active-slide');
                prevSlide.fadeIn(duration).addClass('.active-slide');

                var currentDot = $('.active-dot');
                var prevDot = currentDot.prev();

                currentDot.removeClass('.active-dot');
                prevDot.addClass('.active-dot');
            })

};

$(document).ready(main);

How to fix it?


#2

Hi

This is not the problem that you mention but this line should be inside the if just above

Then concerning your error


#3

3 posts were split to a new topic: What is Wrong Here?