PDA

View Full Version : HV menu shifts at different screen resolutions



kalew
11-03-2006, 08:19 PM
1) Script Title:
HV menu

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex1/hvmenu/index.htm

3) Describe problem:
I am having problem getting this menu positioned correctly. Actually, with my computer screen set at 800x600 pixels, the position is great (as I have it defined in the exmplmenu.js file). But when I adjust my screen to 1024x768 (to see how it will look on other people's screens), this menu is shifted to the left - not where I want to to be positioned. I have the code placed directly below the <body> tag, as instructed. Do you know what I must do in order to get the menu to be positioned correctly (more-or-less centered within the page) for all screen resolutions? Perhaps some of my other code is interfering...Thank you.

jscheuer1
11-04-2006, 07:32 AM
In the documentation for this menu, in the config.htm that comes with the distribution archive, this is a little more than halfway down the page:


originally from - HVmenu config.htm (Explanation of exmplmenu_var.js file):

TargetLoc
Text string- Enables relative positioning of the menu.
1- In the HTML-file where the menu shows you need a named div:
<div id='MenuPos' style='position:relative'></div>
2- Set TargetLoc to 'MenuPos'
3 - Set MenuCentered to 'left', MenuVerticalCentered to 'top' and StartTop and StartLeft to 0
4 - StartTop, StartLeft and the Menu center variables can still be used to get an offset from the <div>.

Remarks: the different ways browsers interpret the pageX and pageY offset makes this feature difficult. I got the best results by putting the div inside a table, give the div the same dimensions as the first level menu, put an transparent image inside the div with again the same dimensions as the first level menu
<table>
<tr><td>
<div id='MenuPos' style='position:relative; width:102; height:102;'><img src='transparent.gif' width='102' height='102'></div>
</td></tr>
</table>

It's a little tricky but, it works in most cases. What this then does is allow you to center or otherwise position and set dimensions for the containing table as you would any other normal element.