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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:32:19+00:00 2026-05-24T20:32:19+00:00

Hi this is my code which I use on one div in order to

  • 0

Hi this is my code which I use on one div in order to automatically set its height to window one. The script works great in Firefox but not in Chrome or Safari. I tried few methods to fix it including some from previous posters but without effect, unfortunatelly. I think that the problem is hiding somewhere in document.getElementById("ID").style.height but I am not completely sure. I will be glad if someone can help. Thanks in advance! 🙂

window.onload = Resize;
window.onresize = Resize;
function Resize() {
  if (document.documentElement.scrollHeight === document.documentElement.clientHeight)
  {
     document.getElementById("ID").style.height = (window.innerHeight-220) + "px";
  }
};
  • 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-24T20:32:20+00:00Added an answer on May 24, 2026 at 8:32 pm

    try this

    function getHeight() {
        var myHeight = 0;
        if (typeof(window.innerHeight) == 'number') {
            //Non-IE
            myHeight = window.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) {
            //IE 6+ in 'standards compliant mode'
            myHeight = document.documentElement.clientHeight;
        } else if (document.body && document.body.clientHeight) {
            //IE 4 compatible
            myHeight = document.body.clientHeight;
        }
        return myHeight;
    }
    
    function getScrollY() {
        var scrOfY = 0;
        if (typeof(window.pageYOffset) == 'number') {
            //Netscape compliant
            scrOfY = window.pageYOffset;
        } else if (document.body && document.body.scrollTop) {
            //DOM compliant
            scrOfY = document.body.scrollTop;
        } else if (document.documentElement && document.documentElement.scrollTop) {
            //IE6 standards compliant mode
            scrOfY = document.documentElement.scrollTop;
        }
        return scrOfY;
    }
    
    function Resize() {
        document.getElementById("ID").style.height = Math.round(getHeight() + getScrollY()) + "px";
    }
    window.onload = Resize();
    window.onresize = Resize();
    

    This will set the height of the ID to the height of the browser window + the vertical scroll offset.

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

Sidebar

Related Questions

i am trying to use this code: <%= File.ReadAllText(Server.MapPath(Members/newsletters/welcome.html))%> which works great but now
This is my first jQuery script, which works great in Firefox and Chrome, but
I use this code which is taken from MVC futures and attach the Attribute
In my application I use the ShinyBlue.xaml resource dictionary which has this code for
I have this code which compiles and works as expected: class Right {}; class
Let's say I have this code: <div id=content> </div> and I use a simple
I have this code which is called at an onChange event of an function
I have this code which gets WP posts, but it gets all the posts
I have this code (which is way simplified from the real code): public interface
I have this code which will include template.php file from inside each of these

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.