Please Note:
HierMenus is protected by copyright laws. Use of the HierMenus code requires a paid licensing agreement.
Click Here to Register

Site Navigation
Bulletins
About
Documentation
FAQ
Samples
Known Issues
Technology Jobs

internet.commerce

Partner With Us
KVM Switches
Promotional Pens
Imprinted Gifts
Car Donations
Phone Cards
Promotional Items
Compare Prices
Calling Cards
Online Education
Promote Your Website
Get Business Software
Desktop Computers
Best Price
PDA Phones & Cases

          
internet.com

IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

 
HierMenusCentral Enhance the Functionality of Your Web Site with DHTML HierMenus.
    

home / bulletins / 11

When TLC Isn't Enough

D.M Ragle, December 11, 2003

[The function described in this article was originally designed as an add on tool for HierMenus version 5. A version of the function is automatically included (and therefore immediately available) in the HierMenus version 6 HM_Loader.js file. The version supplied in the version 6 loader file is used in the same manner as the version described here. Note that in the version 6 codeset the function is called HM_f_GetMenuDimension. -Ed.]

A little used but powerful feature of HierMenus arrays allows for the X/Y coordinates of any top level menu (i.e,. the Top Left Corner of the menu) to be specified as JavaScript expressions. These expressions are then dynamically evaluated by HM each time the menu is displayed. Using your own custom function defitions, you can place top level menus on your Web page based on some other element of the page, such as dynamically created objects generated via your own JavaScript code. This "coordinates-as-expressions" functionality was originally introduced with the release of HierMenus 4.0; and later enhanced (in 4.0.10) to recognize the current mouse position in the expressions via the mouse_x_position and mouse_y_position keywords.

A common question asked by HM implementors is how to position the menus based not on the TLC of the menu, but instead based on one of the other coordinates. For example, in designs that pop up menus from the lower portion of the screen, the bottom left corner might be more appropriate. And for designs that pop up menus from the right edge of the screen (common in pages where right-to-left directionality is employed, see Bulletin 9 for more HM-specific information), top right corner positioning is called for. Though HM does not directly support such positioning schemes, using the coordinates-as-expressions feature described above in combination with a small amount of custom code that we will provide in this article will allow you to provide coordinates relative to the menu corner most appropriate for your specific design.

Which Corner is Which?

As mentioned above, top level menus in HierMenus can be positioned using either integers or JavaScript expressions that return integers representing the top left corner of the menu (each coordinate can be retrieved via a separate function). For permanently displayed menus, such coordinates are a required element of your menu configurations. For pop up menus they are optional, as all top-level pop up menus assume the current location of the mouse for the position of the top left corner of the menu. Since the current mouse position can also be referenced within JavaScript expressions (as of HM 4.0.10), this means that the following two menu configurations will behave identically:

HM_Array1 = [
[120,      // menu width
,          // left_position
],         // top_position
["Experts","/experts/",1,0,0],
["Contents","/index2.html",1,0,0]
]

HM_Array2 = [
[120,                 // menu width
"mouse_x_position",   // left_position
"mouse_y_position"],  // top_position
["Experts","/experts/",1,0,0],
["Contents","/index2.html",1,0,0]
]

While HierMenus recognizes only TLC based menu positioning, you can use custom JavaScript expressions to make those top left coordinates relative to other information on the page. Simple geometry dictates that, in order to position menus based on a different corner of the menu, we require only the width and/or height of the menu itself. Our JavaScript expressions can then place the TLC of a top level menu relative to those computed coordinates. Or, in other words:

Box Geometry, adding height or width to TLC gives coordinates of other box corners

This is all basic stuff, and most folks who ask the coordinate positioning question stated above already understand this. What they lack, however, is the code they could use in their own JavaScript expressions to determine the width and/or height of a menu. That's the main topic on the next page.

current pageTo Page 2
[next]



JupiterOnlineMedia

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

Solutions
Whitepapers and eBooks
IBM eBook: Planning a Service Oriented Architecture
IBM eBook: Choosing the Right Architecture--What It Means for You and Your Business
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Avaya Article: Using Intelligent Presence to Create Smarter Business Applications
Intel Go Parallel Article: Getting Started with TBB on Windows
Microsoft Article: 7.0, Microsoft's Lucky Version?
Avaya Article: How to Feed Data into the Avaya Event Processor
IBM Article: Developing a Software Policy for Your Organization
Microsoft Article: Managing Virtual Machines with Microsoft System Center
Intel Go Parallel Article: Intel Threading Tools and OpenMP
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Silverlight 2 App and Walkthrough: Leverage Silverlight 2 with SQL Server and XML
IBM Article: Enterprise Search--Do You Know What's Out There?
HP Demo: StorageWorks EVA4400
Microsoft Article: The Progress and Promise of Deep Zoom
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
Created: 3/25/2004
Updated: 3/25/2004
URL: http://www.hiermenuscentral.com/bulletins/11/