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














          
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
Intel PDF: Virtualization Delivers Data Center Efficiency
Intel eBook: Managing the Evolving Data Center
Microsoft Article: BitLocker Brings Encryption to Windows Server 2008
Symantec eBook: The Guide to E-Mail Archiving and Management
Microsoft Article: RODCs Transform Branch Office Security
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
Avaya Article: Advancing the State of the Art in Customer Service
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Avaya Article: Avaya AE Services Provide Rapid Telephony Integration with Facebook
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Seminar: Efficiencies in Hardware/Software Virtualization
HP Webcast: Disaster Recovery Planning
Go Parallel Video: Performance and Threading Tools for Game Developers
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
IBM TCO eKIT: Your IT Budget is Under Attack, Get in Control
IBM Energy Efficiency eKIT: Learn How to Reduce Costs
30-Day Trial: SPAMfighter Exchange Module
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
Microsoft Article: Silverlight Streaming--Free Video Hosting for All
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
HP Demo: StorageWorks EVA4400
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
Created: 3/25/2004
Updated: 3/25/2004
URL: http://www.hiermenuscentral.com/bulletins/11/