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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:20:36+00:00 2026-05-20T14:20:36+00:00

So ive been trying out a couple jQuery plugins to help assist me in

  • 0

So ive been trying out a couple jQuery plugins to help assist me in showing a loading div/img when content is being fetched using ajax, but alas it’s all been unsuccessful, the code i use is this:

jQuery(document).ready(function($) {
        function load(num) {
            $('#pageContent').load(num +".html");
        }

        $.history.init(function(url) {
                load(url == "" ? "1" : url);
            });

        $('#bbon a').live('click', function(e) {
                var url = $(this).attr('href');
                url = url.replace(/^.*#/, '');
                $.history.load(url);
                return false;
            });
    });

im guessing there might be an easy way to implement such code in this, but, my pages are relatively small in size apart from one (which is why i want a ‘loading’ div/img displayed).

Do you think i should simply preload the content of that one page thats large instead of utilising another plugin or code?

if so is there a preload in jquery for content? i know there is for images.

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

    You can accomplish what you’re trying by adding an animation before you try to load the contents and letting the animation disappear in the callback of load().

    jQuery(document).ready(function($) {
            function load(num) {
                $('#pageContent').load(num +".html", function() {
                    $('#animation').hide();
            });
        }
    
        $.history.init(function(url) {
            load(url == "" ? "1" : url);
        });
    
        $('#bbon a').live('click', function(e) {
                $('#animation').show();
                var url = $(this).attr('href');
                url = url.replace(/^.*#/, '');
                $.history.load(url);
                return false;
            });
    });
    

    Make an image or a div with id=animation that is hidden as default.

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

Sidebar

Related Questions

Ive been pulling my hair out trying to figure out how to embed a
I've been trying for a couple days to figure out why my QAbstractLisModel won't
I've been trying for a couple hours now to figure out why JavaScript wouldn't
Hi Ive been pulling my hair out over this for the last couple of
I've been stuck trying to puzzle this out for a couple days now, and
I've been trying to figure this out for a couple days now. I have
I've been trying out MVC 4 lately. Started with the developer preview, and now
I've been trying to figure out a way to update the interface after each
I've been trying to figure out how to do this all afternoon, but can't
I've been trying to figure out how to do this, and was thinking it

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.