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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:53:46+00:00 2026-05-13T21:53:46+00:00

i have 2 img elements. 2 id’s for them: rimg and limg. limg is

  • 0

i have 2 img elements. 2 id’s for them: rimg and limg.
limg is the loading gif and rimg is the reloaded full vertsion of the image.

the is the code to show the loading before image finish to load:

$("#limg").fadeIn("fast");
$("#rimg").attr("src",$(that).attr("bsrc")).load(function(){
    $("#limg").fadeOut("fast",function () {
        $("#rimg").attr("alt",$(that).attr("alt"));
        $("#rimg").fadeIn("normal");
});
});

if i log into the site for the first time, it shows me the loading gif.
if it is not my first time it is still showing that but i need the loading to be smooth without that loading
how can i check if the image is loaded and cached before showing the loading gif?

  • 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-13T21:53:46+00:00Added an answer on May 13, 2026 at 9:53 pm

    I think this is the only solution for you: if you build the following into your jquery script then will work.

    var pic=new Image(x,y);//x,y is optional
    pic.src= //path;
    
    if(pic.complete) donePic()
    else pic.onload= donePic;
    

    If you put it inside of a timer then you’ll know when it gets loaded.

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

Sidebar

Related Questions

I have code that loads a bunch of images into hidden img elements and
I have $(elements[current]).html(); that returns <a href=#><img style=width:991px;height:230px; src=img/image.jpg alt=img></a> and i need to
I have an image tag enclosed in an anchor element like this: <a href='$image'><img
why when i write document.getElementByClass('home1').setAttribute('style', 'background-image:url(img/red_menu.PNG);'); it doesn't work? i have the element with
I have a div with elements (h3, img, p) inside. I want to use
I have a div (with a fixed width) that has 2 image elements as
I have to discriminate some page elements (image, css, ...) on the base of
I have a few elements. The number of them on the page changes constantly,
I have an IMG tag in my HTML5 document that reads: <img src="elements/background.png" alt=""
I have a header element with 2 elements inside - an img and p

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.