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

  • Home
  • SEARCH
  • 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 4042930
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:03:56+00:00 2026-05-20T13:03:56+00:00

I have been trying create a gallery for my website but i couldn’t solve

  • 0

I have been trying create a gallery for my website but i couldn’t solve the problem with changing the thumbnails with the large one from the dynamic id’s.

Here is what i would like to do:

I had two separated unordered lists. First one holds the large pictures the second one holds the thumbs. Both list items has the same id numbers but different id names. Large pictures’ id’s are preview-1, preview-2, etc. and the Thumbnails id’s are thumbnail-1,thumbnail-2,etc.

I want to change the thumbnail pictures with the same id number of the large when the user click on it.

For example: If i click on the id=”thumbnail-3″ then the large img id=”preview-3″ should fadein immediately after the current large image fading out.

Here is my sample HTML

<ul class="previews">
<li id="preview-10"><a class="gallery product_2 jqzoom" href="foto1_lg.jpg"><img width="314" height="450" src="foto1.jpg"></a></li>
<li id="preview-11"><a class="gallery product_2 jqzoom" href="foto2_lg.jpg"><img width="314" height="450" src="foto2.jpg"></a></li>
<li id="preview-12"><a class="gallery product_2 jqzoom" href="foto3_lg.jpg"><img width="314" height="450" src="foto3.jpg"></a></li>
<li id="preview-13"><a class="gallery product_2 jqzoom" href="foto4_lg.jpg"><img width="314" height="450" src="foto4.jpg"></a></li>
<li id="preview-14"><a class="gallery product_2 jqzoom" href="foto5_lg.jpg"><img width="314" height="450" src="foto5.jpg"></a></li>
<li id="preview-15"><a class="gallery product_2 jqzoom" href="foto6_lg.jpg"><img width="314" height="450" src="foto6.jpg"></a></li>

This is the large image box

And..

<ul class="thumbnails">
<li id="thumbnail-10"><img width="70" height="70" src="tn1.jpg"></li>
<li id="thumbnail-11"><img width="70" height="70" src="tn2.jpg"></li>
<li id="thumbnail-12"><img width="70" height="70" src="tn3.jpg"></li>
<li id="thumbnail-13"><img width="70" height="70" src="tn4.jpg"></li>
<li id="thumbnail-14"><img width="70" height="70" src="tn5.jpg"></li>
<li id="thumbnail-15"><img width="70" height="70" src="tn6.jpg"></li>

this is the thumbnail box.

I hope you guys help me on this one.

Thanks!

UPDATED

By the way, Is there any chance to add .current class to the selected thumbnail? The previously selected ones should be disappear when the user clicked?

  • 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-20T13:03:57+00:00Added an answer on May 20, 2026 at 1:03 pm

    If both lists are in the same order, I mean thumbnail and it’s corresponding preview are in the same place in their lists, then your problem can be solved even without using these ids at all.

    Solution using id

    $('ul.thumbnails > li').click(function() {
        var preview_id = 'preview-' + $(this).attr('id').split('-')[1];
    
        $('ul.previews > li:visible').fadeOut('normal', function() {
                $('#'+preview_id).fadeIn();
        }); 
    });
    

    Without using id

    $('ul.thumbnails > li').click(function() {
        var thumb_number = $(this).index();
    
        $('ul.previews > li:visible').fadeOut('normal', function() {
                $('ul.previews > li').eq(thumb_number).fadeIn();
        }); 
    });
    

    Both solutions imply that there is always at least one preview visible at a time. Otherwise fadeIn function will not be called.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to create something like: http://jquerystyle.com/index.php - when you go over
I have been trying to create a Ruby program that will be running online
I have been trying to create a JFormattedTextField array which populates in a pane.
I have been trying to create a decorator that can be used with both
I have been trying to create a regular expressions pattern that matches any reference
I have been trying to create an array of a class containing two values,
I have been trying to create a chat bubble for about a month now...
I am trying to post data to MVC controller action but have been unsuccessful
I know there have been plenty of questions about this, but I've been trying
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,

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.