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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:55:10+00:00 2026-05-29T08:55:10+00:00

I have a basic image gallery with four thumbnails and four large images one

  • 0

I have a basic image gallery with four thumbnails and four large images one of which is shown, I would like to be able to click on each thumbnail and replace the active large image with the corresponding large image to what was clicked, before I was able to change a single part of the source as below, but this option will no longer work as I can no longer depend on the src of the image:

jQuery('#thumbs').delegate('img','click', function() {
    jQuery('#panel img').attr('src', jQuery(this).attr('src').replace('99_99','600_399'));
});

I have dynamically added each of the four images and thumbnails into two arrays:

var large_photos = jQuery('#panel').find('img').map(function(){
    return jQuery(this).attr('src');
}).get();

var thumbnails = jQuery('#thumbs').find('img').map(function(){
    return jQuery(this).attr('src');
}).get();

How can I amend the script so that I can click on a thumbnail and the larger image is displayed?

HTML:

<div id="panel">
    <img src="/cache/data/691294/IMGP1617_600_399_s_c1.JPG" alt="" width="600" height="399" />
    <img src="/cache/data/691294/IMGP1618_600_399_s_c1.JPG" alt="" width="600" height="399" style="display: none;" />
    <img src="/cache/data/691294/IMGP1619_600_399_s_c1.JPG" alt="" width="600" height="399" style="display: none;" />
    <img src="/cache/data/691294/IMGP1620_600_399_s_c1.JPG" alt="" width="600" height="399" style="display: none;" />
</div>

<div id="thumbs">
    <img src="/cache/data/691294/IMGP1617_99_99_c1.JPG" alt="" width="99" height="99" />
    <img src="/cache/data/691294/IMGP1618_99_99_c1.JPG" alt="" width="99" height="99" />
    <img src="/cache/data/691294/IMGP1619_99_99_c1.JPG" alt="" width="99" height="99" />
    <img src="/cache/data/691294/IMGP1620_99_99_c1.JPG" alt="" width="99" height="99" />
</div>
  • 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-29T08:55:11+00:00Added an answer on May 29, 2026 at 8:55 am

    This uses the index of the clicked thumb to add a class to the corresponding index of the large image.

    $('#thumbs img').click( function() {
        var thumbindex = $(this).index();
        $('.active').removeClass('active');
        $('#panel img').eq(thumbindex).addClass('active');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

currently I have the a basic jQuery gallery: <ul> <li>IMAGE</li> <li>IMAGE</li> </ul> // with
I have standard basic article content type which, amongst other things, contains an image
I have a very simple basic bar's graphic like this one but i want
I have an image of a basic game map. Think of it as just
I have a basic model in which i have specified some of the fields
I have a basic ActiveRecord model in which i have two fields that i
I am working on a database design for a basic photo gallery which each
I'm trying to do something like in this Tutorial , a very basic gallery.
I have a rather basic question. I have several(5) UIImageView images on my screen.
I have a basic linear layout, with image view that display photos, textviews that

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.