Previous Dot 2


#1

Continuing the discussion from Previous Dot 2:

Continuing the discussion from Help on exercise 11. Previous Dot 2:



https://www.codecademy.com/en/courses/web-beginner-en-seyrq/0/11?content_from=make-an-interactive-website%3Ajquery-effects

`


#2

Is there a question to go with this?


#3

Oops, try again. Remember to remove '.active-dot' from the current dot. 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').last();
}

 
currentSlide.fadeOut(600).removeClass('active-slide');
prevSlide.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();
    
    var currentDot = $('.active-dot');
    var prevDot = currentDot.prev();

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

 
currentSlide.fadeOut(600).removeClass('active-slide');
prevSlide.fadeIn(600).addClass('active-slide');
    
currentDot.removeClass('active-dot');
prevDot.addClass('active-dot')

});

$(document).ready(main);

Can't figure out what's wrong


#4

Did you mean, $('.slide').first()?


#5

Still same error came up.


#6

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').last();
}
currentSlide.fadeOut(600).removeClass('active-slide');
prevSlide.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();
    
    var currentDot = $('.active-dot');
    var prevDot = currentDot.prev();

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

 
currentSlide.fadeOut(600).removeClass('active-slide');
prevSlide.fadeIn(600).addClass('active-slide');
    
currentDot.removeClass('active-dot');
prevDot.addClass('active-dot')

});

$(document).ready(main);

#7

Must have got distracted, or had a major brain fart. Sorry about that.

... = $('.dot').first();

#8

Still got same error

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').last();
}
currentSlide.fadeOut(600).removeClass('active-slide');
prevSlide.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();
    
    var currentDot = $('.active-dot');
    var prevDot = currentDot.prev();

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

 
currentSlide.fadeOut(600).removeClass('active-slide');
prevSlide.fadeIn(600).addClass('active-slide');
    
currentDot.removeClass('active-dot');
prevDot.addClass('active-dot');
    
});

$(document).ready(main);

#9

In my haste, another typo. first. Eyesight is not what it once was.


#10

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