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 987331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:27:42+00:00 2026-05-16T05:27:42+00:00

I have a slider with 4 elements whose any of them has the class

  • 0

I have a slider with 4 elements whose any of them has the class ‘control_tab’. The active element has the class ‘active’. A few seconds later, the slider moves along and the next element becomes the active one. Then it has the class ‘active’; the previous element that has been previously active looses the class ‘active’.

I need to know when an element becomes the active one. As soon as any element becomes the active one by being added the class ‘active’, the active element’s index is printed out to the console.

Here is the sample code:

<div id="controls">   
  <a href="#" class="control_tab">
    <span>A</span>
  </a>
  <a href="#" class="control_tab active">
    <span>B</span>
  </a>
  <a href="#" class="control_tab">
    <span>C</span>     
  </a>
  <a href="#" class="control_tab last">
    <span>D</span>    
  </a>    
</div>

Sorry if the message is a little bit confused,I am exhausted to ponder that stuff :p

Thanks for your help.

R.

  • 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-16T05:27:43+00:00Added an answer on May 16, 2026 at 5:27 am

    If you don’t have control over the code that is adding/removing the active class, there’s a plugin called livequery that will fire code for you when there’s a DOM change that matches a selector.

    http://brandonaaron.net/code/livequery/docs

    $('.active').livequery(function() {
        console.log($(this).index() + ' is now active');
    });
    

    It can also fire code when an element is removed (or unmatched).

    $('.active').livequery(function() {
        console.log($(this).index() + ' is now active');
    }, function() {
        console.log($(this).index() + ' is no longer active');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Slider in my app that is connected to a few methods. In
I have a slider that has a fade-in and fade-out transition. It basically cycles
I have a div and it contains elements like this: <div class='anyClass' style='float:left'> <ul
I have a tabbed jquery slider that I'm using to display elements of an
is it possible to create a jquery slider in which the elements have variable
I have web page that has a collection of tiled elements as a background.
I have two elements: .navAbout #slider On hover of .navAbout, which is an A
In code below is function that converts slider class into slider control. It has
I have 5 elements in a jQuery slider, the slider elements are then cloned
I have a slider on my page that has a height of 200px and

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.