Why do I have to addClass or removeClass?

  1. Select the '.arrow-prev' element and use .click() to attach a new event handler

  2. Inside the event handler,

a. Use jQuery to select the '.active-slide' element, and save it in a new variable named currentSlide

b. Select the previous slide using .prev(), and save it in a new variable named prevSlide

c. Fade out currentSlide in 600 milliseconds and remove the 'active-slide' class from it.

d. Fade in prevSlide in 600 milliseconds and add the 'active-slide' class to it

Here in exersice 2c and 2d.

 $('.arrow-prev').click(function() {
    var currentSlide = $('.active-slide');
    var prevSlide = currentSlide.prev();



Hi @fritz5248564,

That's how the computer knows which slide to display for the user.


Because you are cycling through the slider and the active slide is changing per your command. When you click on the next arrow, the the active-slide will become inactive and the next slide will be the new active slide.


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