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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:57:53+00:00 2026-05-18T10:57:53+00:00

I had googled for a long time to find out the solution but failed

  • 0

I had googled for a long time to find out the solution but failed in the end.

Here comes my detail problems below:

I have a javascript code written with jQuery lib.

$('<link id="userCSS" rel="stylesheet" href="'+link+'" type="text/css" charset="utf-8">').insertAfter("title");

You can find out that we will dynamically load the CSS file from somewhere else.

And then , because the file generated by someone’s server is different from person to person, there may have a random css segment like this:

body,html {
  background:#000 url(http://i43.tinypic.com/xxxx.jpg) top left no-repeat;
  font-family:Arial,Verdana,sans-serif;
  font-size:12px;
}

So , here comes a problem ! I hope I can trigger the onload event when background image is loaded but I had tried all ways with no hope.

Does anyone have some related experiences with this and give me a hand !? 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-05-18T10:57:54+00:00Added an answer on May 18, 2026 at 10:57 am

    No example code, but the best I can suggest is to extract the full url in parentheses, then create an image object, set the source to that url, and then bind whatever you action you want to the onload for that image. I’m not 100% it will work, but I believe that the image will only be downloaded once for both the background and your new image object, firing the event at the correct time.

    You may need to also use the event.special.load plugin in case the image in the background gets downloaded before the image object is created. Because if that happens, it’ll be coming from the cache which the onload event may or may not handle correctly.

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

Sidebar

Related Questions

I've had a look around SO and Google but can't find a definite and
Long time listener, first time caller here. Ok, I apologize for the length of
I gather that coming here is like asking Einstein about long-division, but hoping someone
I had a long time decoding IR codes with optimum's Ken Shirriff Arduino Library.
Well this is not the first time im asking these question here but I
Since short time ago, Google + has had hangouts implemented on the iPhone. You
Had to download Command Line Tools from Apple to get make to work, but
I have been using Java for a long time, and for quite some time
I had a long detailed question about how to get a specific calendar's event
Alright, it has been a long couple of days trying to figure this out

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.