This forum is now read-only. Please use our new forums! Go to forums
Interactive Website:Flipboard 9/12
I keep getting “Oops, try again. Remember to fade out the current slide and remove the ‘active-slide’ class.” I have that coded so I’m not sure what the problem is, help me out?
/start code/ 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();
currentSlide.fadeOut(600).removeClass('active-slide');
nextSlide.fadeIn(600).addclass('active-alide');
currentDot.removeClass('.active-dot');
nextDot.addClass('.active-dot');
if(nextSlide.length == 0) {
nextSlide = $('.slide').first();
nextDot = $('.dot').first();
});
$('.arrow-prev').click(function() {
var currentSlide = $('.active-slide');
var preSlide = currentSlide.prev();
currentSlide.fadeOut(600).removeClass('active-slide');
prevSlide.fadeIn(600).addClass('active-slide');
if(prevSlide.length == 0) {
prevSlide = $('.slide').last();
}
});
};
$(document).ready(main);
/endcode/
I’ve already tried removing the semi colon that’s after the curly brace, I’ve seen ppl say to remove that in other forums but that hasn’t worked.
Answer 5602d3c6d3292f012a000238
there are two things wrong with your code. First: if(prevSlide.length == 0) { prevSlide = $(‘.slide’).last(); } needs to be above the fadeIn/fadeOut lines so that it can fade what’s in the if statement in or out. Second, your ‘.prev-arrow’ event handler is inside your ‘.next-arrow’ event handler. take it out.
Testing, testing. This is just a test.
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
zou are from prison school