JavaScript: How to find out width and height of viewpoint in browser window? -


How to get the width and the height of the view in the browser window? And how does it show how much document is scrolled down and right?

Try this function ... and call it when needed :)

>
  function getViewPortSize () {var viewportwidth; Var viewting; // Standard browsers (Mozilla / Netscape / Opera / IE7) if (typeof window.innerWidth! = 'Undefined') {viewportwidth = window.innerWidth, viewportheight = window.innerHeight} // IE 6 and if (document of Document.documentElement! = 'Undefined' & amp; amp; and type document.documentElement.clientWidth! = 'Undefined' & amp; document.documentElement.clientWidth! = 0) {viewportwidth = document.documentElement .clientWidth, viewportheight = document.documentElement.clientHeight} / / large IEEE {viewportwidth = document.getElementsByTagName ('body') [0] .clanwidth, viewportite = document.getAlementsBitagnam ('body') [0]. Enthait) return Wuportvidth + "~" + Wuporthait; }  

Comments

Popular posts from this blog

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -

iphone - How do I make a UIPickerView in a UIActionSheet -