Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Positioning menus

Status
Not open for further replies.
jl8789,

Try the following:

add a global var here:

var menucolor="#000000" //specify menu color
var submenuwidth=150 //specify sub menus' color
[blue]var topOffset=50 //set top offset[/blue]

find this function in your "html" and "add" your topOffset:

function UpdateIt(){
if (ie&&keepstatic&&!opr6)
document.all["MainTable"].style.top = document.body.scrollTop[blue] + topOffset[/blue];
setTimeout("UpdateIt()", 200);
}

Find this section of code in the "Menu" function and add your width:

HTMLstr += "<!-- MENU PANE DECLARATION BEGINS -->\n";
HTMLstr += "\n";
if (ie||ns6) HTMLstr += "<div id='MainTable' style='position:absolute;top:0;left:0;'>\n";
//if (n) HTMLstr += "<layer name='MainTable'>\n";
HTMLstr += "<table width='[blue]600[/blue]' bgcolor='"+this.bgColor+"' border='"+this.mainPaneBorder+"'>\n";
HTMLstr += "<tr>";

And add your offSet here:

function updateIt(e)
{
if (ie&&!opr6)
{
var x = window.event.clientX;
var y = window.event.clientY;

if (x > rightX || x < leftX) hideAll();
else if (y > rightY[blue] + topOffset[/blue]) hideAll();
}
if (n||ns6)
{
var x = e.pageX;
var y = e.pageY;

if (x > rightX || x < leftX) hideAll();
else if (y > rightY[blue] + topOffset + 25[/blue]) hideAll();
}
}


I tested the changes in IE6 and NN7.
If it doesn't work I may have forgotten something.
So shout back if it doesn't work just right.

HTH
 
Set the "top" also,

HTMLstr += "<!-- MENU PANE DECLARATION BEGINS -->\n";
HTMLstr += "\n";
if (ie||ns6) HTMLstr += "<div id='MainTable' style='position:absolute;[blue]top:50[/blue];left:0;'>\n";
//if (n) HTMLstr += "<layer name='MainTable'>\n";
HTMLstr += "<table width='600' bgcolor='"+this.bgColor+"' border='"+this.mainPaneBorder+"'>\n";
HTMLstr += "<tr>";

Thanks,
 
Thank you very much! I was on the right track, but just wasn't setting things in the right places.
I was working with the div instead of the table itself.
I then set the table align to the right to get it over there etc.
 
Tried setting the top:50 before, and it didn't work. That's why I was getting stuck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top