Percentage of height of original document height

I would like to reset the height of the original document to remove extra space after adding elements. Now I have the code.

    $(document).ready(function() {
       var document_height = $(document).height();
       document_height = 0.70 * document_height;
       $(document).height(document_height);
    });

This should change the height of the document, but it is not. Is there a better way to do this?

+3
source share
2 answers

The code in the original question really works. Something else added more space to the document.

0
source

I think you need to use $(window)instead $(document).

$(document)refers to the height of the entire document, $(window)refers to the size of the viewport.

, CSS /, " " .

+3

All Articles