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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:01:04+00:00 2026-05-15T08:01:04+00:00

Edit: Here is the new code: $(#normalcontent).hide(fast).load($this.attr(href) + #normalcontent,,function(){ $(this).slideDown(normal); $(this).find(img).each(function(){ if($(this).hasClass(large)) { var

  • 0

Edit: Here is the new code:

        $("#normalcontent").hide("fast").load($this.attr("href") +" #normalcontent","",function(){
        $(this).slideDown("normal");
        $(this).find("img").each(function(){
            if($(this).hasClass("large"))
            {
                var myThis=$(this);
                myThis.css("display","none");
                var img = new Image();
                $(img).attr("src", "images/ajax-loader.gif");
                $(img).css({
                    border:"none",
                    width:"16px",
                    height:"11px"
                });
                myThis.after(img);
                myThis.load(function(){
                    $(img).remove();
                    myThis.fadeIn("normal");
                })
                .error(function(){
                    $(img).attr("src","images/errorIcon.png").css({
                        border:"none",
                        width:"14px",
                        height:"14px"
                    });
                });
            }
        });
    });

Hello.

Let’s say I have a link in “index.php”, when I click on that link, it loads, via ajax, a content from a page “content.php” into a div element in “index.php”, that has an id of “#content”. That content in “content.php” has large images. I want to display an image loader, say “ajax-loader.gif”, instead of those large images, until the images are downloaded by client.

( I know how to have an image loader .gif for the images on “index.php”. )

How can I achieve this?

  • 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-15T08:01:04+00:00Added an answer on May 15, 2026 at 8:01 am
    $('#blah').load('/index.php #content', function () {
        $(this).find('img').each(function () {
            var self = $(this),
                replacee = $('<img src="/ajax-loader.gif/>');
    
            this.onload = function () {
                replacee.replaceWith(self);
            };
    
            self.replaceWith(replacee);
        });
    });
    

    I’d be careful about your layout though… I doubt swopping large images for small loaders is ideal. As a user, I’d prefer to delay the showing of the whole content, until all images have loaded.

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

Sidebar

Ask A Question

Stats

  • Questions 494k
  • Answers 494k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use the readlink command to get the content of a… May 16, 2026 at 11:06 am
  • Editorial Team
    Editorial Team added an answer Native XML Extensions I prefer using one of the native… May 16, 2026 at 11:06 am
  • Editorial Team
    Editorial Team added an answer Here this process is described in details: Posting To Facebook… May 16, 2026 at 11:06 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

The last minimized code is, I hope it will help someone: $(#menu).find(a).hover(function(){ $(this).addClass(active); },function(){
In theory, this code should set the new lock status to the users and
Here's the relevant code: Public class User.cs: public void FindByID(int id) { Parser parser
I've got a simple upload form. Here's my code: <form id=Form1 method=post enctype=multipart/form-data runat=server
I created a new ASP.NET MVC application. The home page looks like this: I
Edit : Note that my final purpose here is not having the class working,
I'm basically trying to do this , but I don't know what T will
I'm trying to find a way to implement file manager functionality in an mvc
Consider the following code: class Program { static void Main(string[] args) { A a
I am new to assembly language. I have written a program for taking an

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.