C
Chris
I think the js function below is the culprit creating problems on my
website.
Often the content of the problem page will not fully appear until
there is some mouse movement from the user, unitl then most of the
page remains blank? I am guessing it has something to do with the
browser trying to get dimensions for the popup layer that I place in
the centre of the users page when required.
Would the code below suggest I am correct in my assumption and how
would I address the problem?
Many thanks,
Chris
// JavaScript Document
//////////////////////////////////////////////////////////////////////////////
function xDocSize()
{
var b=document.body, e=document.documentElement;
var esw=0, eow=0, bsw=0, bow=0, esh=0, eoh=0, bsh=0, boh=0;
if (e) {
esw = e.scrollWidth;
eow = e.offsetWidth;
esh = e.scrollHeight;
eoh = e.offsetHeight;
}
if (b) {
bsw = b.scrollWidth;
bow = b.offsetWidth;
bsh = b.scrollHeight;
boh = b.offsetHeight;
}
sWindowHeight = esh;
return {w:Math.max(esw,eow,bsw,bow),h:Math.max(esh,eoh,bsh,boh)};
}
//////////////////////////////////////////////////////////////////////////////
window.size = function()
{
var w = 0;
var h = 0;
//IE
if(!window.innerWidth)
{
//strict mode
if(!(document.documentElement.clientWidth == 0))
{
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
}
//quirks mode
else
{
w = document.body.clientWidth;
h = document.body.clientHeight;
}
}
//w3c
else
{
w = window.innerWidth;
h = window.innerHeight;
}
return {width:w,height:h};
}
window.center = function()
{
var hWnd = (arguments[0] != null) ? arguments[0] : {width:0,height:
0};
var _x = 0;
var _y = 0;
var offsetX = 0;
var offsetY = 0;
//IE
if(!window.pageYOffset)
{
//strict mode
if(!(document.documentElement.scrollTop == 0))
{
offsetY = document.documentElement.scrollTop;
offsetX = document.documentElement.scrollLeft;
}
//quirks mode
else
{
offsetY = document.body.scrollTop;
offsetX = document.body.scrollLeft;
}
}
//w3c
else
{
offsetX = window.pageXOffset;
offsetY = window.pageYOffset;
}
_x = ((this.size().width-hWnd.width)/2)+offsetX;
_y = ((this.size().height-hWnd.height)/2)+offsetY;
return{x:_x,y:_y};
}
website.
Often the content of the problem page will not fully appear until
there is some mouse movement from the user, unitl then most of the
page remains blank? I am guessing it has something to do with the
browser trying to get dimensions for the popup layer that I place in
the centre of the users page when required.
Would the code below suggest I am correct in my assumption and how
would I address the problem?
Many thanks,
Chris
// JavaScript Document
//////////////////////////////////////////////////////////////////////////////
function xDocSize()
{
var b=document.body, e=document.documentElement;
var esw=0, eow=0, bsw=0, bow=0, esh=0, eoh=0, bsh=0, boh=0;
if (e) {
esw = e.scrollWidth;
eow = e.offsetWidth;
esh = e.scrollHeight;
eoh = e.offsetHeight;
}
if (b) {
bsw = b.scrollWidth;
bow = b.offsetWidth;
bsh = b.scrollHeight;
boh = b.offsetHeight;
}
sWindowHeight = esh;
return {w:Math.max(esw,eow,bsw,bow),h:Math.max(esh,eoh,bsh,boh)};
}
//////////////////////////////////////////////////////////////////////////////
window.size = function()
{
var w = 0;
var h = 0;
//IE
if(!window.innerWidth)
{
//strict mode
if(!(document.documentElement.clientWidth == 0))
{
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
}
//quirks mode
else
{
w = document.body.clientWidth;
h = document.body.clientHeight;
}
}
//w3c
else
{
w = window.innerWidth;
h = window.innerHeight;
}
return {width:w,height:h};
}
window.center = function()
{
var hWnd = (arguments[0] != null) ? arguments[0] : {width:0,height:
0};
var _x = 0;
var _y = 0;
var offsetX = 0;
var offsetY = 0;
//IE
if(!window.pageYOffset)
{
//strict mode
if(!(document.documentElement.scrollTop == 0))
{
offsetY = document.documentElement.scrollTop;
offsetX = document.documentElement.scrollLeft;
}
//quirks mode
else
{
offsetY = document.body.scrollTop;
offsetX = document.body.scrollLeft;
}
}
//w3c
else
{
offsetX = window.pageXOffset;
offsetY = window.pageYOffset;
}
_x = ((this.size().width-hWnd.width)/2)+offsetX;
_y = ((this.size().height-hWnd.height)/2)+offsetY;
return{x:_x,y:_y};
}