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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:44:57+00:00 2026-05-13T06:44:57+00:00

Still learning this jQuery stuff…. I like this ajax page loader; it works for

  • 0

Still learning this jQuery stuff….

I like this ajax page loader; it works for WordPress on a <div id="content"> right out of the box. But one thing bothers me: the collapses while ajax loads the page and spins the spinner, and I’d like to be able to have the div retain some of it’s size instead of making the footer of the page jump up and then down. The doesn’t have to be taller than 500-600 px, just so it doesn’t bounce the footer up and down. Is that possible with this function in the way it’s written? Below are the most relevant functions. (Others I’ve left out have to to with WordPress and its URL structure.)

function loadPage(url){
  if(!isWorking){
    scroll(0,0);
    document.getElementById('content').innerHTML='<center><img src="'+loadingIMG.src+'" /></center>';
    http.open('GET',url,true);
    isWorking=true;
    http.onreadystatechange=showPage;
    http.send(null);
  }
}

function showPage(){
  if(http.readyState==4){
    if(http.status==200){
      isWorking=false;
      var content = http.responseText;
      content = content.split('id="content"')[1];
      content = content.substring(content.indexOf('>')+1);
      var depth=1;
      var output='';
      while(depth>0){
        temp = content.split('</div>')[0];
        //count occurrences
        i=0;
        pos = temp.indexOf("<div");
        while(pos!=-1){
          i++;
          pos = temp.indexOf("<div",pos+1);
        }
        //end count
        depth=depth+i-1;
        output=output+content.split('</div>')[0]+'</div>';
        content = content.substring(content.indexOf('</div>')+6);
      }
      document.getElementById('content').innerHTML=output;
      pageLoaderInit();
    }else{
      alert(http.status);
    }
  }
}
  • 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-13T06:44:57+00:00Added an answer on May 13, 2026 at 6:44 am

    I don’t actually see any jquery there, but you should be able to use plain old javascript to set the height of the content div.

    In loadPage:

    var contentDiv = document.getElementById('content');
    contentDiv.innerHTML='<center><img src="'+loadingIMG.src+'" /></center>';
    contentDiv.style.height = "600px";
    

    In showPage:

    var contentDiv = document.getElementById('content');
    contentDiv.innerHTML=output;
    contentDiv.style.height = "";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm still learning ASP.NET and I often see code like this throughout parts of
This is going to sound like a silly question, but I'm still learning C,
Sorry for all the dumb jquery questions I'm still learning and find this to
I'm still learning about REST and, in my test, came up with this scenario
I'm a jquery newbie... still learning the framework.... and here goes my query... The
Seems like a simple thing to do (although im still learning the ins and
I'm still learning jquery and javascript so please bear with me. I've used a
Hi I am still learning Jquery and have a problem accessing form elements. My
I am still learning jQuery and have come up against something I just can't
I'm still learning about jQuery, but I have not been able to find a

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.