js navigation menu

  1. /** 
  2. style 
  3. */  
  4.   
  5. .chanel_list  
  6. {  
  7.     float:left;  
  8. width:auto;  
  9. background-color:#F0F0EE;  
  10. border-top:solid 3px #288dab;  
  11. }  
  12. .chanel_list_item  
  13. {  
  14.     height: 33px;  
  15.     line-height: 33px;  
  16.     border:solid 1px #DEDEDE;  
  17.     border-top:none;  
  18.     text-align:left;  
  19.     font-size:14px;  
  20.     padding-left:30px;  
  21.     cursor:pointer;  
  22.     margin-top:2px;  
  23.     background:url(../images/common/pixel_round2.png) no-repeat 15px center;  
  24.     color:#666;  
  25. }  
  26. .chanel_list_item_hover  
  27. {  
  28.     font-weight:bold;  
  29.     color:#288dab;  
  30.     border-right: none;  
  31.     background:none;  
  32.     background: url("../images/common/arrow_left.png") no-repeat scroll left center #FFFFFF;  
  33. }  
  34. .chanel_list_item_bottom  
  35. {  
  36.     height: 87px;  
  37.     border:solid 1px #DEDEDE;  
  38.     border-top:none;  
  39. }  
  40. .chanel_list_right  
  41. {  
  42. width:740px;  
  43. background-color:#fff;  
  44. border:solid 1px #288dab;  
  45. border-left:none;  
  46. border-top:solid 2px #F0F0EE;  
  47. }  
  48. .chanel_list_right_title  
  49. {  
  50. float:left;  
  51. border-left:none;  
  52. height:33px;  
  53. line-height:33px;  
  54. padding-left:20px;  
  55. width:720px;  
  56. }  
  57. .chanel_list_right_content  
  58. {  
  59. float:left;  
  60. border-left:solid 1px #288dab;  
  61. padding:10px;  
  62. padding-top:0px;  
  63.   
  64. }  
  65. .chanel_list_right_item  
  66. {  
  67. background:url(../images/common/arrow.gif) no-repeat 10px 16px;  
  68. float:left;  
  69. height:35px;  
  70. line-height:35px;  
  71. margin-top:5px;  
  72. margin-left:5px;  
  73. font-size:13px;  
  74. padding-left:25px;  
  75. width:690px;  
  76. background-color:#efefef;  
  77. overflow:hidden;  
  78. }  
  79. .chanel_list_right_item_hover  
  80. {  
  81.     background-color:#FF9;  
  82.       
  83. }  
  84.   
  85.   
  86.   
  87. <script type="text/javascript">  
  88. <!--  
  89. var  y = 0;  
  90. There are  x = 0;  
  91.   
  92. var classid = "";  
  93. was  timeoutId = 0;  
  94. jQuery(function() {  
  95.     jQuery(".chanel_list_item").bind("mouseenter"function() {  
  96.         afterMouseLeaveRes();  
  97.   
  98.         var temp = jQuery(this).attr("id");  
  99.           
  100.   
  101.         y = jQuery(this).offset().top-2;  
  102.         x = jQuery(this).offset().left+jQuery(this).width()+23;  
  103.         jQuery(".chanel_list_right").css("top", y);  
  104.         jQuery(".chanel_list_right").css("left", 210);  
  105.   
  106.         classid = jQuery(this).attr("id");  
  107.         jQuery(".chanel_list_right_children").hide();  
  108.         jQuery("#class_" + classid).show();  
  109.   
  110.         jQuery(this).addClass("chanel_list_item_hover");  
  111.         jQuery(".chanel_list_right").show();  
  112.     });  
  113.   
  114.     jQuery(".chanel_list_item").bind("mouseleave"function(e) {  
  115.         mouseX = e.pageX;  
  116.         divX = jQuery(this).offset().left + jQuery(this).width() + 23;  
  117.         if (mouseX > divX) {  
  118.             afterMouseLeaveRes();  
  119.         }  
  120.     });  
  121.   
  122.     jQuery(".chanel_list_right").bind("mouseleave"function() {  
  123.         afterMouseLeaveRes();  
  124.     });  
  125.     jQuery(".chanel_list_right_item")  
  126.             .bind(  
  127.                     "mouseenter",  
  128.                     function() {  
  129.                         jQuery(  
  130.                                 ".chanel_list_right_item .chanel_list_right_item_hover")  
  131.                                 .removeClass("chanel_list_right_item_hover");  
  132.                         jQuery(this).addClass(  
  133.                                 "chanel_list_right_item_hover");  
  134.                     });  
  135.     jQuery(".chanel_list_right_item").bind("mouseleave"function() {  
  136.         jQuery(this).removeClass("chanel_list_right_item_hover");  
  137.     });  
  138. });  
  139.   
  140.   
  141.   
  142. function afterMouseLeaveRes() {  
  143.     jQuery(".chanel_list_item_hover").removeClass("chanel_list_item_hover");  
  144.     jQuery(".chanel_list_right_item_hover").removeClass(  
  145.             "chanel_list_right_item_hover");  
  146.     jQuery("#chanel_list_right").hide();  
  147. }  
  148.       
  149.     function secondarySearch(subjectId,parentId,parentName)  
  150.     {  
  151.         document.location.href = "<%=realPath%>/search/searchresult?subjectId="  
  152.                 + subjectId + "&parentId=" + parentId  
  153.                 + "&parentIdLevel=1&parentName=" + parentName;  
  154.     }  
  155. //-->  
  156. </script>  
  157. <!--content1-->  
  158. <div class="content_top">  
  159.   
  160.     <div class="content_top_left">  
  161.         <! - Navigation menu ->  
  162.         <div class="chanel_list">  
  163.             <s:iterator value="menuNavigationsList" status="arr">  
  164.                 <div class="chanel_list_item"  
  165.                     id="<s:property value="viewClaRelEntity.cid"/>">  
  166.                     <a  
  167.                         href="javascript:secondarySearch('<s:property value="#request.libId"/>','<s:property value="viewClaRelEntity.cid"/>','<s:property value="viewClaRelEntity.name"/>')"><s:property  
  168.                             value="viewClaRelEntity.name" /></a>  
  169.                     <%-- <s:property value="viewClaRelEntity.name" /> --%>  
  170.                 </div>  
  171.             </s:iterator>  
  172.         </div>  
  173.   
  174.         <div id="chanel_list_right" class="chanel_list_right"  
  175.             style="left: 0px; overflow: hidden; position: absolute; top: 0px; display: none;">  
  176.             <s:iterator value="menuNavigationsList" status="arr">  
  177.                 <div id="class_<s:property value="viewClaRelEntity.cid"/>"  
  178.                     class="chanel_list_right_children" style="display: none">  
  179.                     <div class="chanel_list_right_content">  
  180.                         <s:iterator value="lsNavigationsA" status="arr">  
  181.                             <div class="chanel_list_right_item"  
  182.                                 style=" height: auto; line-height: 15px;">  
  183.                                 <a style="font-weight: 900; color: #288DAB;"  
  184.                                     href="javascript:secondarySearch('<s:property value="#request.libId"/>','<s:property value="viewClaRelEntity.cid"/>','<s:property value="viewClaRelEntity.name"/>')">  
  185.                                     <s:property value="viewClaRelEntity.name" />  
  186.                                 </a>:  
  187.                                 <s:iterator value="lsNavigationBs" status="arr1">  
  188.                                 <s:if test="%{viewClaRelEntity.name==null}">  
  189.                                 <br/>  
  190.                                 </s:if>  
  191.                                 <s:else>  
  192.                                     <a style="font-weight: 900;"  
  193.                                         href="javascript:secondarySearch('<s:property value="#request.libId"/>','<s:property value="viewClaRelEntity.cid"/>','<s:property value="viewClaRelEntity.name"/>')">  
  194.                                         <s:property value="viewClaRelEntity.name" />、  
  195.                                     </a>  
  196.                                     </s:else>  
  197.                                 </s:iterator>  
  198. <br/>  
  199.                             </div>  
  200.                             <div style="height: 2px;"></div>  
  201.   
  202.                         </s:iterator>  
  203.                     </div>  
  204.                 </div>  
  205.   
  206.             </s:iterator>  
  207.         </div>  
  208.     </div>  
  209. </div>  

Reproduced in: https: //my.oschina.net/kt431128/blog/224707

Guess you like

Origin blog.csdn.net/weixin_33858336/article/details/91952453