Written jQuery-style, but only mildly dependent.
I needed/wanted this code because I was making a modal overlay and wanted the modality to exactly cover the body. The 'modality' is what I've termed the click-proof smoked-glass panel (div).
Note: this is not intended to give you the viewport diemensions, but rather the entire [scrollable] document dimensions.
// var docSize is declared elsewhere
$(window).resize(function(){
var h = $('body')[0];
docSize = {
width: h.scrollWidth
,height: Math.max(
$('html')[0].scrollHeight, //webkit
h.scrollHeight, //ff
document.documentElement.offsetHeight //ie
)
};
});
No comments:
Post a Comment