Path-Menu

Path-Menu
 点击下载

Hierarchical, wrappable (when container width gets smaller than the menu length), mouse-hover and Tab-key driven menu bar. Originally created to represent a path to the selected item in a tree-view. A usage example:

  1. <link href="jquery.path-menu.css" type="text/css" rel="stylesheet" /> 
  2. <script type="text/javascript" src="jquery-1.2.6.js"></script> 
  3. <script type="text/javascript" src="jquery.metadata.js"></script> <!-- OPTIONAL --> 
  4. <script type="text/javascript" src="jquery.hoverIntent.js"></script> <!-- OPTIONAL --> 
  5. <script type="text/javascript" src="jquery.path-menu.js"></script> 
  6. <script type="text/javascript"> 
  7. <!-- 
  8. $(document).ready(function(){ 
  9.     // path-menu elements initialization after document's loaded 
  10.     $('#Menu1').path_menu({animation_speed:0}); 
  11. }); 
  12. //--> 
  13. </script> 
  14. . . .  
  15. <div id='Menu1' class="{z_index:1500}"> 
  16.     <div><a title='Item 1' href='#'>Item 1</a></div> 
  17.     <div><a title='Item 2' href='#'>Item 2</a> 
  18.         <div class='{popup_max_height:50}' style="font-weight:bold"> 
  19.             <a title='Item 2.1' href='#'>Item 2.1</a> 
  20.             <a title='Item 2.2' href='#'>Item 2.2</a> 
  21.             <a title='Item 2.3' href='#'>Item 2.3</a> 
  22.             <a title='Item 2.4' href='#'>Item 2.4</a> 
  23.             <a title='Item 2.5' href='#'>Item 2.5</a> 
  24.             <a title='Item 2.6' href='#'>Item 2.6</a> 
  25.             <a title='Item 2.7' href='#'>Item 2.7</a> 
  26.         </div> 
  27.     </div> 
  28.     . . . 
  29.     <div><a title='Item 4' href='#'>Item 4</a> 
  30.         <div> 
  31.             <a title='Item 4.1' href='#'>Item 4.1</a> 
  32.             <a title='Item 4.2' href='#'>Item 4.2</a> 
  33.             <div><a title='Item 4.3' href='#'>Item 4.3</a> 
  34.                 <div> 
  35.                     <a title='Item 4.3.1' href='#'>Item 4.3.1</a> 
  36.                     <a title='Item 4.3.2' href='#'>Item 4.3.2</a> 
  37.                     . . . 
  38.                     <a title='Item 4.3.5' href='#'>Item 4.3.5</a> 
  39.                     <div><a title='Item 4.3.6' href='#'>Item 4.3.6</a> 
  40.                         <div> 
  41.                             <a title='Item 4.3.6.1' href='#'>Item 4.3.6.1</a> 
  42.                             <a title='Item 4.3.6.2' href='#'>Item 4.3.6.2</a> 
  43.                             . . . 
  44.                             <a title='Item 4.3.6.16' href='#'>Item 4.3.6.16</a> 
  45.                         </div> 
  46.                     </div> 
  47.                     <a title='Item 4.3.7' href='#'>Item 4.3.7</a> 
  48.                     . . . 
  49.                     <a title='Item 4.3.11' href='#'>Item 4.3.11</a> 
  50.                     <a title='Item 4.3.12' href='#'>Item 4.3.12</a> 
  51.                 </div> 
  52.             </div> 
  53.             <a title='Item 4.4' href='#'>Item 4.4</a> 
  54.             <a title='Item 4.5' href='#'>Item 4.5</a> 
  55.         </div> 
  56.     </div> 
  57. </div> 

To make it look like a regular menu bar, the triangular images can be removed by removing the "background" CSS attribute from the "div.PathElementHover" and "div.PathElement" classes in the jquery.path-menu.css file. It can make use of the metadata (see the menu item 2 in the example) and hoverIntent plugins. The available options (can be changed directly, used as parameters (see the example) and as metadata for individual DIV elements) with their default values are as follows:

  1. // 
  2. // plugin defaults 
  3. // 
  4. $.fn.path_menu.defaults = { 
  5.     popup_max_height: 200, // popup maximum height in pixels 
  6.     shadow_offset_x: 3, // right shadow width in pixels (IE only) 
  7.     shadow_offset_y: 2, // bottom shadow height in pixels (IE only) 
  8.     animation_speed: "fast"// popup displaying/hiding speed 
  9.     z_index: 1000, // menu z-index (root div element only) 
  10.     hoverIntent: false // "true" requires the hoverIntent plugin (root div element only) 
  11. }; 

 

转载请注明:代码家园 » Path-Menu

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)