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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:50:32+00:00 2026-06-17T21:50:32+00:00

I am making a website where by clicking on a next button, the browser

  • 0

I am making a website where by clicking on a next button, the browser requests a new image URL from the server and loads the image using jQuery. I want to show the loading image on top of the old image when the request happened (like Facebook).

HTML

<div1>
    <img id="rel" src="http://localhost/images/original.jpg" height="400" width="500"></img>
    <div2>
        <img id="rel" src="http://localhost/images/loading.jpg" height="40" width="50"></img>
    </div2>
</div1>

CSS

div1
{
    position:relative;
}

div2
{
    position:absolute;
    top:50%;
    left:50%;
}

When I try this in jsFiddle the image does not appear over the other image. I only know basic CSS. Forgive any blunders in the above code.

  • 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-17T21:50:33+00:00Added an answer on June 17, 2026 at 9:50 pm
    <div id="parentDiv">
       <img id="rel1" src="http://localhost/images/original.jpg" height="400" width="500" />
       <img id="rel2" src="http://localhost/images/loading.jpg" height="40" width="50" />
    </div>
    

    CSS:

    #parentDiv
    {
       position:relative;
    }
    
    #rel2
    {
       position:absolute;
       top:50%;
       left:50%;
    }
    

    There was some errors with your code:

    <img></img> should be <img />
    

    You should not have two same ID rel

    You must put both images in the same Parent Div, give it a position:relative; so that the second image is considered absolute to this Parent Div, not to the whole page.

    Check this http://jsfiddle.net/Kfxha/

    To Position the second image right at the center, you must make some math calculations.

    top = ( rel1.height - rel2.height ) / 2 =  ( 400 - 40 ) / 2 = 180px
    left = ( rel1.width - rel2.width ) / 2 = ( 500 - 50 ) / 2 = 225px
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a website using the jQuery UI Tabs plugin which is great. However,
i'm making a music website. i have this button image for adding a song
I'm making a website using JSP and servlets and I have to now break
I'm making a website in Aptana and i'm using an empty div element for
I'm making an image browser where you van edit the name of the image
i am making a website using asp.net and C# and well i got stuck
I'm making a website Using JSF and richfaces, but I need to do some
I'm using jQuery idTabs in an upcoming redesign for my website. I've styled it
Long story short, im making a small website using ajax but its more for
I'm making website that have notification 'button'. When user click this button, notification div

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.