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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:52:09+00:00 2026-06-16T02:52:09+00:00

Possible Duplicate: window.onload vs document.ready jquery i am having this problem: i have an

  • 0

Possible Duplicate:
window.onload vs document.ready jquery

i am having this problem: i have an image on the page which is not that big one. and i have a js function which sets the left sidebar height dynamically depending on the height of the content and on the size of window. so if i resize the page, the sidebar resizes also dynamically. but now, the sidebar height is being set very early, ending up being set incorrectly. the setting will happen in “`document.ready“ function which should fire after all DOM is ready including images, right?

here is my page, please open this in chrome, you will see the issue more clearly.
http://www.stahlbaron.de/standort/

and here is my js function which sets the sidebar dynamically.

<script type="text/javascript">
   var calculateSize = function () {
   var winh = document.body.clientHeight;
   var footer = document.getElementById('footer').offsetHeight;
   document.getElementById('sidebar').style.height = winh - 5/2*footer + 'px';
   document.getElementById('sidebar').style.marginBottom = footer + 'px';
}
$(document).ready(function(){
   calculateSize();
   $(window).resize(calculateSize);
});

thanks for any view and your time!

  • 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-16T02:52:10+00:00Added an answer on June 16, 2026 at 2:52 am

    You should trap on $(window).on('load', ...) rather than $(document).ready.

    The former waits for images (and all other content) to load while the latter only waits for the DOM tree representing the elements that are in the HTML source to be created.

    Since you want the same function to be called when you resize, you can combine the event registrations:

    $(window).on('load resize', calculateSize);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: $(document).ready equivalent without jQuery I know you can use the window.onload event
Possible Duplicate: $(document).ready equivalent without jQuery I have a framework-less javascript that executes on
Possible Duplicate: Restore WindowState from Minimized I have window which is normally hidden in
Possible Duplicate: how to access parent window object using jquery? I have the following
Possible Duplicate: ie8 var w= window.open() - “Message: Invalid argument.” check this page out:
Possible Duplicate: JQuery: $(window).resize() doesn't work on Load I have the below jQuery function.
Possible Duplicate: How does this JavaScript/JQuery Syntax work: (function( window, undefined ) { })(window)?
Possible Duplicate: Open child browser window from child window I have a list of
Possible Duplicate: JavaScript library to create div-style window within page I would like to
Possible Duplicate: Javascript window resize event I want to get an event which is

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.