-2

how can i calculate body width and height for all browser in java query...

$(document).ready(function () {
        $(document).ready(sizeContent01);
        function sizeContent01() {
            var totHeight = ($("body").height());
            var hdrHeight = $("#header").outerHeight(true);
            var ftrHeight = $("#footer").outerHeight(true);
            var bdyHeight1 = totHeight - hdrHeight - 10;
            var outputHeight = bdyHeight1 - $(".input_content").outerHeight(true) - 10;
            $("#body").css("height", bdyHeight1);
            $(".output_content").css("height", (outputHeight - 5));
        };
        $(window).resize(sizeContent02);
        function sizeContent02() {
            var totHeight = ($("body").height());
            var hdrHeight = $("#header").outerHeight(true);
            var ftrHeight = $("#footer").outerHeight(true);
            var bdyHeight1 = totHeight - hdrHeight - 10;
            var outputHeight = bdyHeight1 - $(".input_content").outerHeight(true) - 10;
            $("#body").css('height', bdyHeight1);
            $(".output_content").css('height', (outputHeight - 5));
        };
    });

please any one help me....

  • possible duplicate of [How to get height of entire document with JavaScript?](http://stackoverflow.com/questions/1145850/how-to-get-height-of-entire-document-with-javascript) – Paddy Nov 17 '14 at 12:37
  • 1
    jQuery doesn't stand for "Java Query". jQuery is built upon JavaScript. Java and JavaScript are two completely different languages. There's no actual documentation on what the `j` in jQuery stands for, however, it's most likely "JavaScript", but it could be "John" (Resig) - jQuery's founder. – James Donnelly Nov 17 '14 at 12:38
  • Duplicate question. Search before posting question – murli2308 Nov 17 '14 at 14:27

2 Answers2

0

In jQuery : $( window ).height(); and in pure js : window.innerHeight;

Atleast ive done godly with these. Then if you want the height off whole html document (includes scrolling) you can use this with jQuery : $( document ).height();

J0N3X
  • 228
  • 2
  • 14
0
$(window).height();
$(window).width();

More info

If you think the scroll bar will be a problem you can try hiding them then taking your measurement

document.body.style.overflow = "hidden";
var viewportWidth = $(window).width();
var viewportHeight = $(window).height();
document.body.style.overflow = "";

Duplicate of Get the height and width of the browser viewport without scrollbars using jquery?

Community
  • 1
  • 1
Kevin Kopf
  • 13,327
  • 14
  • 49
  • 66