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

The Archive Base Latest Questions

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

I would like to replace images on click but also have the replaced image

  • 0

I would like to replace images on click but also have the replaced image click to a lightbox. Here is my example where the first image has the lightbox: http://www.artdesigngroup.co/products/test.html

My thought is that I need to apply the “display” ID on the surrounding div and replace the images within this div. But how do I do this and create the lightbox?

Thank You.

  • 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-27T06:16:25+00:00Added an answer on May 27, 2026 at 6:16 am

    I would rethink your structure for handling this. Most of what you are doing can be handled with straight jQuery instead of rolling your own swap functions. When you ask your questions, including a Fiddle is a great way to get an answer faster. Note that I am using jQuery 1.7’s prop method here which you should be using instead of attr.

    http://jsfiddle.net/txbqX/3/

    jQuery to get what you want

    //when main image is clicked, show it in colorbox
    $('#foo a').colorbox();
    
    //when thumb is clicked, set main image to it
    $('div#thumbs img').click( function() {
        $('#foo a').prop('href', $(this).prop('src'));
        $('#foo img').prop('src', $(this).prop('src'));
        return false;  //stop link from navigating
    })
    

    Simplified HTML

    <div id="foo" > 
        <a href="http://www.artdesigngroup.co/images/tv-frames/01.jpg">
            <img src="http://www.artdesigngroup.co/images/tv-frames/01.jpg" width="304" height="304" name="Display" id="display"  />
        </a>
    </div>
    
    <br />
    <div id="thumbs">
        <img src="http://www.artdesigngroup.co/images/tv-frames/01.jpg" width="56" height="56" />
        <img src="http://www.artdesigngroup.co/images/tv-frames/02.jpg" width="56" height="56" />
        <img src="http://www.artdesigngroup.co/images/tv-frames/03.jpg" width="56" height="56" />
        <img src="http://www.artdesigngroup.co/images/tv-frames/04.jpg" width="56" height="56" />
        <img src="http://www.artdesigngroup.co/images/tv-frames/05.jpg" width="56" height="56" />
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to replace a part of the image with my image in
I would like to replace drop down list (that has on change event that
I would like to replace the first character ' x ' with the number
I have the following table and would like to replace the string text of
I have this sample string where I would like to replace the star with
I have a variable myvar = document.getElementById('myid').innerHTML that I would like to replace all
I have a standard html form that uses a background image. I would like
I have an image, and I would like to make the image link to
I have a site where I would like to let users select multiple images
I would like to replace a image with another image when a link is

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.