Ver código fonte

mod 导航高亮

panqiuyao 1 ano atrás
pai
commit
38b69ccfb3
1 arquivos alterados com 17 adições e 4 exclusões
  1. 17 4
      app/home/view/default/base/mall_header.html

+ 17 - 4
app/home/view/default/base/mall_header.html

@@ -159,7 +159,20 @@
                 {/foreach}
             </ul>
         </div>
-       
+
+        <script>
+            $(function(){
+                var  href = location.href;
+                var node = $(".nav_list .site_menu a[href='"+href+"']")
+                if(node.length > 0){
+                    $(".nav_list .site_menu a").removeClass('current')
+                    node.addClass('current')
+                }
+                if(location.pathname === '/' || location.pathname === "{:url('Index/index')}"){
+                    $(".nav_list a").eq(0).addClass('current')
+                }
+            })
+        </script>
     </div>
 </div>
 
@@ -171,7 +184,7 @@
 {notempty name="nav_link_list"}
 <div class="dsh-breadcrumb-layout">
     <div class="dsh-breadcrumb w1200"><i class="iconfont">&#xe6ff;</i>
-        {foreach $nav_link_list as $nav_link} 
+        {foreach $nav_link_list as $nav_link}
         {empty name="nav_link.link"}
         <span>{$nav_link.title}</span>
         {else /}
@@ -194,7 +207,7 @@
 				    var cat_id = $(this).attr("cat_id");
 					var menu = $(this).find("div[cat_menu_id='"+cat_id+"']");
 					menu.show();
-					$(this).addClass("hover");					
+					$(this).addClass("hover");
 					var menu_height = menu.height();
 					if (menu_height < 60) menu.height(80);
 					menu_height = menu.height();
@@ -226,5 +239,5 @@
             $(this).unbind('mouseover');
         });
     });
-    
+
 </script>