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:
- get CKEditor data with Jquery – no plugin required If you are using the CKeditor also with JQuery (not...
- 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...
- 25 jQuery image galleries and slideshow plugins For some sites, image galleries are an absolute must. Portfolios...
- Qooxdoo 0.8.2 Featuring A Cross-Browser “Inspector” Tool Qooxdoo 0.8.2 has just been released with some cool new...







Tue, Jun 8, 2010
Javascript, Programming, Snippets