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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:48:43+00:00 2026-06-06T12:48:43+00:00

I am trying to create very simple image browser with jQuery. I am doing

  • 0

I am trying to create very simple image browser with jQuery. I am doing it only for learning, it will not be used in any project at this time.

I have images and thumbnails as follows:

<div class="images">
  <img src="http://www.dummyimage.com/400x200/222/fff.jpg" alt="" data-idi="1"/>
  <img src="http://www.dummyimage.com/400x200/534/fff.jpg" alt="" data-idi="2"/>
  <img src="http://www.dummyimage.com/400x200/345/fff.jpg" alt="" data-idi="3"/>
  <img src="http://www.dummyimage.com/400x200/fed/111.jpg" alt="" data-idi="4"/>
</div>

<div class="thumbs">
  <button data-idb="1"><img src="http://www.dummyimage.com/50x50/222/fff.jpg" alt="" /></button>
  <button data-idb="2"><img src="http://www.dummyimage.com/50x50/534/fff.jpg" alt="" /></button>
  <button data-idb="3"><img src="http://www.dummyimage.com/50x50/345/fff.jpg" alt="" /></button>
  <button data-idb="4"><img src="http://www.dummyimage.com/50x50/fed/111.jpg" alt="" /></button>   
</div>

Hovering on thumbnail should replace main image above.

I have managed to do it with one, let’s call it ”set” of images, as presented on jsfiddle.net.

Here is simple script used to achieve this:

  $('#images img').hide().first().show();
  $('#thumbs button').on( "mouseover", function(e) {
     var idb = $(this).data("idb");
     $('#images img').hide();
     var img = $('#images').find("[data-idi='" + idb + "']").show();
  });

Now I want to add another set of images, and wrap the script with .each() function. But I am having a problem on very begining, when I am trying to show only first image:

var imgs = $('.images').hide();
$.each(imgs, function( index, val ) {
    var firstImage = $(this).children(":first");
    console.log(firstImage);
    firstImage.show();
});

Proper image is being consoled, but it is not showing, as excepted. Live example on jsfiddle.net. Could you help me with this problem? TIA

  • 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-06-06T12:48:46+00:00Added an answer on June 6, 2026 at 12:48 pm

    You’ve already hidden the parent .images element.

    After calling .show(), you have a visible element inside a hidden parent.

    You need to select the <img> elements themselves by writing $('.images img').

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

Sidebar

Related Questions

I would like to create a very simple image gallery. I am trying to
I am trying to create a very simple CUser class in my project, but
I am trying to create a very simple application (part of my learning program),
I need some help, I am trying to create a very simple jquery slider..
I am trying to create a very simple antlr grammar file which should parse
I'm trying to create a very simple chat application in Flex/.Net using FluorineFX but
I'm trying to create a very simple message board (author, text, and date written)
I'm trying to create a very simple keyframe animation, whereby a graphic Rotates from
I'm trying to create a very simple REST server. I just have a test
I am trying to create a very simple chat window that simply has the

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.