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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:51:26+00:00 2026-06-15T12:51:26+00:00

I setting one of 2 elements to be whichever is the greatest height. I’m

  • 0

I setting one of 2 elements to be whichever is the greatest height. I’m checking the height of window, sidebar and #primary container and making sure whichever is the greatest is the height all elements i set to. However, on this page, on interaction with a select button, there is an ajax load. My page height then increases. I expected the new height to be picked up by my function, but it still returns the old height pre-ajax load.

My code is below:

//on change of the select button load ajax content, then run changeSidebarHeight()
$('#choose-pathway').change(function() {
        var url=$(this).val();
        $('#ajax-pathway-container').load(url + ' #pathway',changeSidebarHeight);
});


function changeSidebarHeight(){
        var primaryHeight=$('#primary').height();
        var sidebarHeight=$('#sidebar').height();
        var windowHeight=$(window).height();    
            //this always returns the same value, before the ajax load and after, despite the page being about 600 pixels taller
            console.log($('html').height());        
        if(primaryHeight > sidebarHeight){
             $('#sidebar').height(primaryHeight );

        }else{
              $('#sidebar').height(windowHeight );
              $('#primary').height(windowHeight);
        }

}
  • 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-06-15T12:51:27+00:00Added an answer on June 15, 2026 at 12:51 pm

    You can use $(document).height(); but keep in mind that with no doctype tag to your page chome reports the same value for both calls ($(window) and $(document)).
    Adding a strict doctype causes the values to work as advertised.
    But you can also use $(body).height();

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

Sidebar

Related Questions

I have 3 elements, two on the same level, and one child, all having
Setting two or more elements of a linear layout the same height seems to
I have a rather large script that is setting the height of five elements
Im trying to work out how to get the value from one setting in
Is it possible for setting more than one adapter to a single list? For
Setting up new git installations. On one Windows laptop, I'm running (under cygwin): git
What is a one-liner code for setting a string in python to the string,
Currently I am setting up a Multishipping checkout on one of my sites running
I had posted one question earlier jQuery inconsistency in setting readonly attribute in IE-8
hi forum member I am having one problem with setting the radiofield in the

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.