Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7519199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:51:46+00:00 2026-05-30T01:51:46+00:00

I am working on a carousel. Whenever a slide changes, I get the index

  • 0

I am working on a carousel.

Whenever a slide changes, I get the index value of that slide.

There are three slides! so 0-2 are the index values.

Now I have this html on the page, for three dots, which indicate which slide is active. So if the dot is white, the slide is active.

This is simply done by adding the “act” class to the element.

<a id="th_1" class="thumb act"></a>
<a id="th_2" class="thumb"></a>
<a id="th_3" class="thumb"> </a>

Above you can see “th_1” is active. The others have all grey dots in the css.

Anyways, I have the index by this js code:

var slide = $(this).find('.slideshow.activated');
var index = slide.index();

Above, we find the element in this slide DIV, which has the classes item and active.
“this” is a container div.

I just don’t know how to make this into a function, which adds the “act” class to the correct html element as above.

perhaps I should change the element names to become zero-based (th_0, th_1, th_2) and use some regex?

I am wondering if anyone knows any tips on this.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:51:47+00:00Added an answer on May 30, 2026 at 1:51 am
    $('.thumb').removeClass('act').eq(index).addClass('act');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i created a carousel in jquery that slides an item or set of items
I have a carousel scrolling through slides. The carousel has an overlay with a
So Im setting some buttons to slide a carousel. preezer.setActiveItem(this.text, slide); Its working just
I have a carousel that I can change the location of with an integer
I'm working on a simple carousel. My problem appears when trying to insert node
Working with a SqlCommand in C# I've created a query that contains a IN
Working on a project at the moment and we have to implement soft deletion
Working on a project that parses a log of events, and then updates a
I've created a slide carousel and it uses pseudo element :before to identify the
I was working on this carousel thing, using the iCarousel . It works pretty

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.