Board Logo

Relative vs. Static Positioning
Somecallmejosh - 3/21/2005 at 11:08 PM

Hello,

I recently downloaded one of the menus from this site... I love it. I have a question about positioning for different resolutions. I created the site in 800X600 resolution and the menu works great. However, when I test the site at 1024X768 the menu maintains its static position (From Origin, I suppose). How can this be scripted to work in differing resolutions? The two resolutions I'm most concerned with are the two mentioned in this post. Here is the menu_tpl.js script:

/* --- geometry and timing of the menu --- */
var MENU_POS = new Array();

// item sizes for different levels of menu
MENU_POS['height'] = [22, 22, 22, 22];
MENU_POS['width'] = [150, 150, 200, 200];

// menu block offset from the origin:
// for root level origin is upper left corner of the page
// for other levels origin is upper left corner of parent item
MENU_POS['block_top'] = [235, 15, 15, 15];
MENU_POS['block_left'] = [25, 100, 100, 100];

// offsets between items of the same level
MENU_POS['top'] = [23, 23, 23, 23];
MENU_POS['left'] = [0, 0, 0, 0];

// time in milliseconds before menu is hidden after cursor has gone out
// of any items
MENU_POS['hide_delay'] = [200, 200, 200, 200];

/* --- dynamic menu styles ---
note: you can add as many style properties as you wish but be not all browsers
are able to render them correctly. The only relatively safe properties are
'color' and 'background'.
*/

var MENU_STYLES = new Array();

// default item state when it is visible but doesn't have mouse over
MENU_STYLES['onmouseout'] = [
'color', ['#000000', '#000000', '#000000', '#000000'],
'background', ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
];

// state when item has mouse over it
MENU_STYLES['onmouseover'] = [
'color', ['#000066', '#000066', '#000066', '#000066'],
'background', ['#ffff66', '#ffff66', '#ffff66', '#ffff66'],
];

// state when mouse button has been pressed on the item
MENU_STYLES['onmousedown'] = [
'color', ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
'background', ['#000066', '#000066', '#000066', '#000066'],
];

________________________________________________
Thanks in advance for any advice you may have to offer on this subject.

Josh


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/