thats why i Love jquery, cause everything is so simple…
To get the width and height of the whole page (document), use:
var pageWidth = $(document).width(); var pageHeight = $(document).height();
To get the width and height of the viewport (window), use:
var viewportWidth = $(window).width(); var viewportHeight = $(window).height();
Opera though has a different approach. with Opera 9.5 $(window).height() returns the document height (more info here)
you can get around this by using
var viewportHeight = window.innerHeight ? window.innerHeight : $(window).height();
Related posts:
- JQuery wildcard selectors JQuery wildcard selectors on select boxes, how to reset all...
- Custom info windows with jQuery and Google Maps Ben Nolan has a writeup on a new feature in...
- Online Load Time for your page Καθώς έψαχνα για optimization tools και resources για MySQL έπεσα...
- HTML 5 section is not just a “semantic div” James Graham of Opera has a post about how section...







Tue, Jun 8, 2010
Javascript, Programming, Snippets