1

I am in need of a way to add an active class to JCarouselLite. What I want to do is set an opacity of .5 to all slides, except the active slide which will be 100% opacity. When the next button is clicked and the carousel slides, I want to remove the active class from the slide and add it to the next slide. Does anyone have experience with this or know of a slider that already implements this feature? Thank you.

user796431
  • 21
  • 2

1 Answers1

1

Something like this?

$(".slide.active").removeClass("active").next(".slide").addClass("active");

If chaining that way doesn't work, this will for sure:

var activeSlide = $(".slide.active");
activeSlide.removeClass("active");
activeSlide.next(".slide").addClass("active");

Your styles would probably look something like this:

.slide
{
    opacity: .5;
    filter: alpha(opacity=50);
}
.slide.active
{
    opacity: 1;
    filter: alpha(opacity=100);
}
Mikey G
  • 3,473
  • 1
  • 22
  • 27