spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com


home / experts / dhtml / column53
Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
Logo

Hiermenus Go Forth, XVII:
Version 4.0.10 - The Complete Script (Full-Window)



Improved Relative Positioning

There has been much demand for improved mouse-coordinate menu positioning.

Currently, HM positions a non-permanent top-level menu at the user mouse coordinates by default, unless absolute coordinates are specified. What HM could not do was position the top-level menu at a mouse coordinate plus/minus a number of pixels.

Since implementation of this feature did not involve major changes, we have included it in Version 4.0.10.

The inclusion of this feature necessitated the introduction of the concept of keywords. We will be using keywords in parameter declaration much more in future versions. For now, we introduce two:

mouse_x_position - denotes the user horizontal mouse position
mouse_y_position - denotes the user vertical mouse position

Keyword Use

Use mouse_x_position and mouse_y_position in your top-level menu arrays when defining the left_position and top_position parameters:

HM_Array2 = [
[,                        // menu width
"mouse_x_position + 10",  // left_position
"mouse_y_position + 20",  // top_position
,                         // font_color
,                         // mouseover_font_color
,                         // background_color
,                         // mouseover_background_color
,                         // border_color
,                         // separator_color
,                         // top_is_permanent
,                         // top_is_horizontal
,                         // tree_is_horizontal
,                         // position_under
,                         // top_more_images_visible
,                         // tree_more_images_visible
,                         // evaluate_upon_tree_show
,                         // evaluate_upon_tree_hide
],                        // right-to-left,
["Experts","http://www.webreference.com/experts/",1,0,1],
["Contents","http://www.webreference.com/index2.html",1,0,0],
["Services","http://www.webreference.com/index2.html",1,0,1],
["About","http://www.webreference.com/about.html",1,0,0]
]

In the above example, the menu created by HM_Array2 will pop up 10 pixels to the right and 20 pixels below the user's mouse position.

Since a top-level menu is positioned at the user mouse coordinates by default, there is no need to specify mouse_x_position/mouse_y_position on their own. The next two examples have the same result:

HM_Array2 = [
[,
"mouse_x_position",  // left_position (with keyword and no other qualifier)
"mouse_y_position",  // top_position (with keyword and no other qualifier)
...],
...
]
HM_Array2 = [
[,
,  // left_position (with no value)
,  // top_position (with no value)
...],
...
]


Outstanding Issues

There are no outstanding issues. Improvements in speed are ongoing.

If you have submitted a problem, received a confirmation, and have not yet seen it corrected, please resubmit using the link on the front page of this column.

Otherwise, I believe we are ready to move on to major changes like framest use and child-specific parameters.

On the next page, the sample page included in the download.


Produced by Peter Belesis and

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags

All Rights Reserved. Legal Notices.
Created: May 15, 2001
Revised: May 15, 2001

URL: http://www.webreference.com/dhtml/column53/3.html