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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:11:43+00:00 2026-05-26T14:11:43+00:00

im trying to position a div relative to an image element. problem is, the

  • 0

im trying to position a div relative to an image element. problem is, the image takes a while to load, and i am getting the offset coordinates of the image’s alt text. im using the jquery’s offset method to get the position of the image, called with jquery’s ready() method.

i’ve tried using the load() method bound to the image (and removing the positioning made from on the ready() method) but the div does not get positioned correctly, not even positioned following the coordinates of the image’s alt text.

any ideas? help?

  • 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-26T14:11:44+00:00Added an answer on May 26, 2026 at 2:11 pm

    Try this. In your function where you’re setting the width of the div, create n image object like so:

    var img = new Image();
    img.src = "http://path.to/image.png"; // TODO: always use pngs...
    img.onload = function(){
        // your existing code here
    }
    

    then, when the image is loaded, the code will execute. You also should not have problems with loading the image twice. One of them (whichever is loaded last) will be based off of the cached version.

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

Sidebar

Related Questions

I am trying to position a span element relative to the upper-right corner of
I'm trying to use a second background image with a floated div but it
im trying to locate the position of the minimum value in a vector, using
I am trying to synchronize the horizontal scroll position of 2 WPF DataGrid controls.
I'm trying to determine the window position of an application. I know SetWindowPos() would
I am trying to create a function which will give me alphabet position when
I am trying to do positioning in JavaScript. I am using a cumulative position
So what I'm trying to accomplish is a simple appendTo a certain element. The
I'm trying to make an optional draggable div, which shows up at some condition.
I'm trying to make a div fadeIn when another div is clicked and fadeOut

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.