Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>Pure JS is difficult; so you'll need a script for that:</p> <p><a href="http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/" rel="nofollow">http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/</a></p></li> <li><p>jQuery on the other hand, is as simple as typing this:</p> <pre><code>$(window).height(); </code></pre></li> </ol> <p><br /> <a href="http://jsfiddle.net/kAnTp/8/" rel="nofollow">JS Fiddle link for a live demo</a> </p> <p><strong>Note:</strong> The window size is <em>the size of the result section</em> in JS Fiddle.</p> <p><br /></p> <h1>Update 1</h1> <p>I found a script that finds the scrollbar size from <a href="http://forum.jquery.com/topic/jquery-dimensions-should-have-a-method-to-return-the-scrollbar-size" rel="nofollow">JQuery Dimensions should have a method to return the scrollbar size</a>:</p> <pre><code>jQuery.getScrollBarSize = function() { var inner = $('&lt;p&gt;&lt;/p&gt;').css({ 'width':'100%', 'height':'100%' }); var outer = $('&lt;div&gt;&lt;/div&gt;').css({ 'position':'absolute', 'width':'100px', 'height':'100px', 'top':'0', 'left':'0', 'visibility':'hidden', 'overflow':'hidden' }).append(inner); $(document.body).append(outer); var w1 = inner.width(), h1 = inner.height(); outer.css('overflow','scroll'); var w2 = inner.width(), h2 = inner.height(); if (w1 == w2 &amp;&amp; outer[0].clientWidth) { w2 = outer[0].clientWidth; } if (h1 == h2 &amp;&amp; outer[0].clientHeight) { h2 = outer[0].clientHeight; } outer.detach(); return [(w1 - w2),(h1 - h2)]; }; </code></pre> <p>The only problem left is it <a href="http://jsfiddle.net/gef7J/1/" rel="nofollow">always adds the scrollbar width &amp; height to the dimensions</a>, regardless if there is a scrollbar or not. One solution to fix this problem is to detect when there is overflow in a web page, and at what dimension (vertical or horizontal). </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload