PDA

View Full Version : Chromemenu within a container



SaintLeger
02-10-2006, 01:13 PM
When I put the menu items definition within a DIV <div style="position:absolute; top:100px">, the dropdown menus are appearing with an extra offset down.

How to fix that ? Thanks

jscheuer1
02-10-2006, 08:30 PM
Try relative position for the container, or better yet just use the default positioning as intended for use with this menu.

If you have to use an absolutely positioned container. Here is where in the script (chrome.js) the top position is set:


this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"

If the 'extra offset down' is the same for all items, just subtract it in the above line (like if it is the 100 you used to position the container):


this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1-100+"px"

But, be aware, different browsers may look at this differently and various adjustments may need to be made for each one, that would be a bit more complex.

SaintLeger
02-10-2006, 10:41 PM
Thanks Mad Prof.
Well, strangely, the negative offset corresponding to the absolute top position of the div container does not force the dropdown menu to stick exactly below the main bar, in IE/Netscape. In the end, probably it is better to use relative position after the top other stuff. But I have to change many things because everything is ouput by PHP.
Anyway thank you for this prompt anwser, the question is closed.