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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:18:08+00:00 2026-06-17T23:18:08+00:00

Okay, I have a unique situation, first I am creating 10 <li> s using

  • 0

Okay, I have a unique situation, first I am creating 10 <li>s using jQuery append(). Then I am adjusting the height of each <li> to be the window height / 10 so that as a whole they fill the whole screen height. My html contains nothing but <div class="wrapper"></div>. Here is my js:

// Create The Tree:

$('.wrapper').append('<ul>');
for (var x = 1; x <= 10; x++)
{
    $('.wrapper > ul').append('<li>Root Option ' + x + '</li>');
}

// Script The Tree:

var $winHeight = document.documentElement.clientHeight;
console.log($winHeight);
var $liNumber = $('.wrapper > ul > li').size();
var $liHeight = $winHeight / $liNumber;
$('.wrapper > ul > li').css('height', $liHeight);

var $win = $(window)
$win.on('resize', update);
function update () {
    console.log(document.documentElement.clientHeight);
}

My problem is that if you view the console, you can see that it does not accuratly update the height of the window. When you resize the window, it wont log values lower than what it was when you last refreshed the page!

  • 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-17T23:18:09+00:00Added an answer on June 17, 2026 at 11:18 pm

    Do you mean this? http://jsfiddle.net/reKSm/2/

    var n = 20
    
    $(document).ready(function (){
        $('.wrapper').append('<ul>');
        for (var x = 1; x <= n; x++)
            $('.wrapper > ul').append('<li>Root Option ' + x + '</li>');
        
        update_size();
        
        $(window).resize(function(){
        update_size();
        }); 
    });
    
    function update_size(){
        // Script The Tree:
        var $winHeight = $(window).height();
        var $liNumber = $('.wrapper > ul > li').length;
        var $liHeight = $winHeight / n;
        $('.wrapper > ul > li').css('height', $liHeight + 'px');    
    };
    

    Also, you have to have doctype defined.
    Place <!doctype html> at the beginning of your html file and it will work.

    And also don’t place the upper JS code into another $(document).ready() function. At already has one in it 🙂

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

Sidebar

Related Questions

Okay I have a large CRUD app that uses tabs with Forms embedded in
In my situation I have a number of files that will be stored on
Okay, I have a table with some junk data and no unique identifier column.
I'm using SQL Server 2008. I have a database table that looks like this
Yes, I know that my problem is not the unique, but I have analysed
Okay basically I am creating a stored procedure that will return data for our
I have a model that has an overriden to_param method returning the (unique) name
EDIT: Sorted. See bottom for solution Okay, I have to write a program that
Okay I have installed a theme in wordpress that returns a few errors. Warning:
Okay I have a jQuery dialog box which has a form in it and

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.