This forum is now read-only. Please use our new forums! Go to forums

banner
Close banner
0 points
Submitted by Farkey
over 9 years

Can't seem to find the prob...

[UPDATE: I never did figure out what was wrong, but, I was able to cut and paste myself through the lesson…]

Oops, try again. When on the last slide, it looks like next arrow isn’t wrapping back to the first dot. Look back at the instructions and check the code inside the if statement

var main = function() { $(‘.dropdown-toggle’).click(function() { $(‘.dropdown-menu’).toggle(); }); $(‘.arrow-next’).click(function() { var currentSlide = $(‘activeSlide’); var nextSlide = currentSlide.next(); if (nextSlide.length == 0) { nextSlide = $(‘.slide’).first(); nextDot = $(‘.dot’).first(); } var currentDot = $(‘.active-dot’); var nextDot = currentDot.next(); currentDot.removeClass(‘active-dot’); nextDot.addClass(‘active-dot’); currentSlide.fadeOut(600).removeClass(‘.active-slide’); nextSlide.fadeIn(600).addClass(‘active-slide’);

}); }

$(document).ready(main);

Answer 5489703d76b8fe7ba0001b5c

0 votes

Permalink

Hey Farkey, you tried using the variable nextDot before you declared it (later in the code). Here’s a code that works for me :

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();
        nextDot = $('.dot').first();
    } 
        
    currentSlide.fadeOut(600).removeClass("active-slide");
    nextSlide.fadeIn(600).addClass("active-slide");
    
    currentDot.removeClass("active-dot");
    nextDot.addClass("active-dot");
    
});

};

$(document).ready(main);

points
Submitted by Corentin Dubois
over 9 years

Answer 547c768c8c1cccb38400cb6a

-3 votes

Permalink

well you see you forgot your scientific notation…

why would you forget this important part of your code?

points
Submitted by Dustin Gunter
over 9 years