jQuery(document).ready(function($){ /****************************************** This menu is designed to have a primary nav list and two secondary flyout levels, with five stacked links in each nav list. If any subnav is short of five items, the script writes in dummy spans to fill them out to the correct height. The menu is sensitive to link wrapping, which should be avoided by insuring that links are not too long for the assigned width (in EM's). Protection against wrapping can be provided by adding: overflow: hidden; white-space: nowrap; ..to the "#dynamicmenu li" CSS rule. The action of holding open the menu to the selected submenu page is accomplished by use of special classes added to the flyout UL's via the plugin script, which key in to CSS rules designed for them. The classes are removed temporarily when the menu is hovered so that other submenu flyouts may be accessed. When the menu is un-hovered the classes are restored. Highlighting has been added to the menu item chain leading to the selected item. *****************************************/ // Get flyout UL's and assign them to variables... var firstFlyout = $("#dynamicmenu>.current_page_ancestor>ul"); var secondFlyout = $("#dynamicmenu>.current_page_ancestor .current_page_ancestor>ul"); // Function adds special classes to the flyout UL's... function addFlyoutClasses() { if(firstFlyout) { $(firstFlyout).addClass('first_flyout'); } if(secondFlyout) { $(secondFlyout).addClass('second_flyout'); } } // Function removes the special classes to the flyout UL's... function removeFlyoutClasses() { if(firstFlyout) { $(firstFlyout).removeClass('first_flyout'); } if(secondFlyout) { $(secondFlyout).removeClass('second_flyout'); } } // Apply the classes on load... addFlyoutClasses(); // The special classes are removed when the menu is hovered, to allow normal flyout operation... $("#dynamicmenu").hover( function() { removeFlyoutClasses(); }, function() { addFlyoutClasses(); }); // Add dummy spans to the flyout UL's so they will have five lines and be the correct height... $("#dynamicmenu, #dynamicmenu>li>ul, #dynamicmenu>li>ul>li>ul").each( function() { var stopAppending = 5 - ($(this).children().length); if (stopAppending > 0) { for (i=0; i ').appendTo(this); } } }); });//end