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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:40:40+00:00 2026-06-03T17:40:40+00:00

How do I go about getting what the height of an element on a

  • 0

How do I go about getting what the height of an element on a page would be if it ignored the ‘height’ css property applied to it?

The site I’m working on is http://www.wncba.co.uk/results and the actual script I’ve got so far is:

jQuery(document).ready(function($) {

    document.origContentHeight = $("#auto-resize").outerHeight(true);
    refreshContentSize(); //run initially
    $(window).resize(function() { //run whenever window size changes
        refreshContentSize();
    });
});

function refreshContentSize()
{       
    var startPos = $("#auto-resize").position();
    var topHeight = startPos.top;
    var footerHeight = $("#footer").outerHeight(true);
    var viewportHeight = $(window).height();    
    var spaceForContent = viewportHeight - footerHeight - topHeight;

    if (spaceForContent <= document.origContentHeight)
    {
        var newHeight = document.origContentHeight;
    }
    else
    {
        var newHeight = spaceForContent;
    }
    $("#auto-resize").css('height', newHeight);
    return; 
}

[ http://www.wncba.co.uk/results/javascript/fill-page.js ]

What I’m trying to do is get the main page content to stretch to fill the window so that the green lines always flow all the way down the page and the ‘Valid HTML5’ and ‘Designed By’ messages are never above the bottom of the window. I don’t want the footer to stick to the bottom. I just want it to stay there instead of moving up the page if there’s not enough content to fill above to fill it. It also must adapt itself accordingly if the browser window size changes.

The script I’ve got so far works but there’s a small issue that I want to fix with it. At the moment if the content on the page changes dynamically (resulting in the page becoming longer or shorter) the script won’t detect this. The variable document.origContentHeight will remain set as the old height.

Is there a way of detecting the height of an element (e.g. #auto-resize in the example) and whether or not it has changed ignoring the height that has been set for it in css? I would then use this to update the variable document.origContentHeight and re-run the script.

Thanks.

  • 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-03T17:40:43+00:00Added an answer on June 3, 2026 at 5:40 pm

    I’ve got it working. I had to rethink it a bit. The solution is on the live site.

    The one think I’d like to change if possible is the

    setInterval('refreshContentSize()', 500); // in case content size changes
    

    Is there a way of detecting that the table row has changed size without chacking every 500ms. I tried (#content).resize(function() but couldn’t to get it to work.

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

Sidebar

Related Questions

http://t-webdesign.co.uk/new/ How would i go about getting the grey div (#content_right) to expand to
How exactly would one go about getting an OpenGL app to run fullscreen straight
I'm getting into HTML right now and today I'm learning about page layout. I
My last question was about getting the string representation of an object serialized to
I'm just about getting into WCF ; but from what I've read so far,
I have a question about getting DLL's directory on Windows system. The situation is
An earlier question was answered about getting the OrderID and the number of associated
I recently posted a question about getting a NullPointerException whenever I called an array
I've converted hello world to QR Barcode image but my question is about getting
I'm getting about the same bad looking resizing from all the 4 algorithms of

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.