I have a small problem with a menu script I am using called Jim's DHTML Menu. Every time the page resizes it calculates its position on the page and then performs a page reload. I really like this feature but I would like to find a way to have the script change position without the page reload - it messes with several javascript forms.
This is the portion of the script that is responsible for the update. Is there any way to update this so it doesn't use location.reload?
Code:
function floatMenu(scrWidth, scrHeight, mrgLeft, adjustNum)
{
if (this.isMainMenu)
{
var bodyWidth = 0, mrg = 0;
if (docType)
{
mrg = mrgLeft + 10;
bodyWidth = document.getElementsByTagName("BODY")[0].offsetWidth;
}
else
{
mrg = 10;
bodyWidth = document.body.scrollWidth;
}
if (adjustNum == 0 || adjustNum == 2)
{
var menuLeft = Math.ceil(this.main.offsetLeft + (screen.width - scrWidth)/2);
this.main.style.left = Math.ceil(menuLeft - (screen.width - bodyWidth)/2 + mrg);
this.iframe.style.left = this.main.offsetLeft;
}
if (adjustNum == 1 || adjustNum == 2)
{
this.main.style.top = this.main.offsetTop + (screen.height - scrHeight)/2;
this.iframe.style.top = this.main.offsetTop;
}
if (this.hasShadow)
{
this.shadow.style.left = this.main.offsetLeft + this.sOffX;
this.shadow.style.top = this.main.offsetTop + this.sOffY;
this.siframe.style.left = this.shadow.offsetLeft;
this.siframe.style.top = this.shadow.offsetTop;
}
window.onresize = new Function("location.reload();");
}
}
This is the portion of the script that is responsible for the update. Is there any way to update this so it doesn't use location.reload?