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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:45:42+00:00 2026-06-02T22:45:42+00:00

When pulling in content dynamically with jQuerys .load() method, the callback function fires when

  • 0

When pulling in content dynamically with jQuerys .load() method, the callback function fires when the request is complete and the HTML is pulled through onto your current page.

Is there a way to work out when the images contained in the new HTML are fully loaded?

Thanks!

  • 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-02T22:45:43+00:00Added an answer on June 2, 2026 at 10:45 pm

    As far as I know, this is not straight-forward. Some may suggest using the .load() event handler, but Jquery documentation has a number of caveats for using that (documentation):

    Caveats of the load event when used with images

    A common challenge developers attempt to solve using the .load()
    shortcut is to execute a function when an image (or collection of
    images) have completely loaded. There are several known caveats with
    this that should be noted. These are:

    • It doesn’t work consistently nor reliably cross-browser
    • It doesn’t fire correctly in WebKit if the image src is set to the same src as before
    • It doesn’t correctly bubble up the DOM tree
    • Can cease to fire for images that already live in the browser’s cache

    The only way that comes to mind is to use jQuery to pull the img elements out of your returned HTML, and use the javascript Image object to load the images. You can attach an .onload event handler to the Image object. You would then have to track when they are all loaded using something like a deferred object, or even a simple counter.

    Here is a demo that pulls out img objects and uses $.Deferred() objects with a $.when() to trigger when all images are loaded:

    http://jsfiddle.net/jtbowden/h4AMG/

    In the demo, the content will only load after the images have loaded. You will need to change $.load() to $.ajax() to have the control to do this.

    Here is a version that uses a basic counter to track loads:

    http://jsfiddle.net/jtbowden/gnW3f/

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

Sidebar

Related Questions

I have two functions that pulling some of content from html and returning it
i have a simple setup, with php pulling html content from a database. if
I'm almost there! I'm successfully pulling my MPEG-4 ES content from my SNC-RZ25N webcams
I'm pulling content from a DB that has been sanitized using mysql_real_escape_string. Accordingly the
I have a Content Query Webpart (CQWP) pulling the URL and title from a
I have the following json content that I'm pulling from a different location: JSON
I'm pulling images into a document via json/ajax. After they get pulled in, I'd
I have a swf one one server that is pulling content from an Amazon
I'm pulling some content from my database and when I display it, I am
I am trying to load an XML file, but the content in the XML

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.