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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:15:22+00:00 2026-05-23T10:15:22+00:00

I have managed to get a carousel so that when the image is changed

  • 0

I have managed to get a carousel so that when the image is changed it will display what number image you are looking at.

if it is image number 3 that is chosen, 3 list rows down is the current images’ code. Am i able to get this is automatically add a class to the image tag imbedded within the list? Below is my code with the itemvisiblein function basically printing out to a certain div.

How am i able clear all classes of the active name and then take that number and add the class to the image tag of that certain line? (same class as caption is currently in) (so if image 3 is selected then add “active” to the image tag imbedded within that code 3 list lines down.

Cheers,

<script type="text/javascript">
function itemVisibleIn(carousel, state){
    $("#gallerydescription").html(carousel.first);  //currently displays image number//

};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
    easing: 'backout',
        animation: 1000,
    vertical: true,
        scroll: 1,
    itemVisibleInCallback: itemVisibleIn, 
       });
});

<ul id="mycarousel" class="jcarousel jcarousel-skin-tango">
        <li><a href="images/gallery/placeholder1.png" rel="shadowbox" title="This is the description"><img class="caption" src="images/gallery/placeholder1.png" width="750" height="450" title="test Title1" alt="This is the title" /></a></li>
        <li><a href="images/gallery/placeholder1.png" rel="shadowbox" title="This is the description"><img class="caption" src="images/gallery/placeholder1.png" width="750" height="450" title="test Title1" alt="This is the title" /></a></li>
        <li><a href="images/gallery/placeholder1.png" rel="shadowbox" title="This is the description"><img class="caption" src="images/gallery/placeholder1.png" width="750" height="450" title="test Title1" alt="This is the title" /></a></li>

So in short

1) get which line is being used for that image (list line)
2) clear all previous active classes
3) add class active to image tag class (along with caption) of the currently selected image

  • 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-23T10:15:23+00:00Added an answer on May 23, 2026 at 10:15 am
    $("img.caption").eq(index).addClass("extraClass");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have managed to get paging to work, almost. I want to display to
So I have managed to get this query working List<string> listStatus = new List<string>()
I have managed to get mongrel_cluster running on my Windows server (v 1.0.5) ok,
I have managed to get a custom very basic extension running in Firefox. What
I have managed to get my first array working but no matter how many
I have managed to get a UPS Shipping calculator working in PHP. I now
I have managed to get a cron job to run a rake task by
I have managed to get my email problem sorted so now everytime a case
I have managed to get the connected clients IP with the code below but
I'm trying to implement a basic jQuery infinite carousel. As much for the learning

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.