
Home
Menu and Navigation
CSS Based
Here
|
Categories
Partners
DaniWeb is an exciting community for web developers, Internet marketers, and technology enthusiasts.
Other Sections
Sweet Ads
Compatibility
|
|
FF1+ IE5+ Opr7+
AnyLink CSS Menu Author:
Note: Updated August 15th 05': Now if menu doesn't have room to drop down nor down, it is positioned at top of visible window edge instead. Only "anylink.js" modified. Description: AnyLink CSS Menu is a cool script that adds a drop down menu to any link on your page. Each menu is implemented as plain HTML (a DIV containing links) on the page, making the menu contents search engine friendly and potentially much easier to deploy and customize than menus where the contents are stored inside the script. And to top things off, the drop down menu behaves intelligently in that if it's too close to the four corners of the browser window, it will reposition itself to avoid being obscured partly. Be sure to also check out AnyLink Drop Down Menu, which differs from AnyLink CSS Menu mainly in that the menu contents are specified inside the script. If your site is dynamic, this may be an easier script to deploy across the entire site. Demo: Step 1: This script uses two external files. Download "anylink.css" and "anylink.js" (by right clicking each file, and selecting "Save As"). Be sure to upload them to your webpage directory. Step 2: Add the below code to the HEAD section of your page: Step 3: Add the following sample HTML to the BODY of your page, which demonstrates how to set up both the Anchor link and drop down menu associated with it: CustomizingThis script is very easy to customize and is flexible. The code of Step 3 shows the basic code for an Anchor link and associated menu: <a href="default.htm"
onClick="return clickreturnvalue()"
onMouseover="dropdownmenu(this, event, 'anylinkmenu2')">Web Design</a> The Anchor link in this case is "Web Design", and the drop down menu, the entire DIV that follows it. You can place the DIV anywhere on your page you see fit, and not necessarily directly below the anchor link. Pay attention to the code in red, as they are mandatory for each Anchor Link plus Menu you're setting up. "anylinkmenu2" should be an arbitrary but unique ID you assign to each menu DIV on your page (<DIV id=uniqueID...>), which this ID entered into the Anchor Link: onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'uniqueID')" This lets the Anchor Link know which menu to reveal. Apart from this, you can customize the look of your DIV very liberally, either by adding a style="" attribute inside the tag, or edit the css of "anylink.css." |