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
Post a Comment