|
|
@@ -2,18 +2,17 @@
|
|
|
$(function(){
|
|
|
|
|
|
//自动根据url把当前菜单激活
|
|
|
- var page_id = GetQueryString('page_id');
|
|
|
+ var current_page_id = $("#current_page_id").val();
|
|
|
//如果中没有指定page_id,则判断有没有父目录为0的页面,默认打开第一个
|
|
|
- if(!page_id) {
|
|
|
- page_id = $(".doc-left li").children("a").attr("data-page-id");
|
|
|
+ if(!current_page_id) {
|
|
|
+ current_page_id = $(".doc-left li").children("a").attr("data-page-id");
|
|
|
};
|
|
|
- if(page_id !=null && page_id.toString().length>0)
|
|
|
+ if(current_page_id !=null && current_page_id.toString().length>0)
|
|
|
{
|
|
|
- var str = 'page_id='+page_id;
|
|
|
$(".doc-left li").each(function(){
|
|
|
- url = $(this).children("a").attr("href");
|
|
|
+ page_id = $(this).children("a").attr("data-page-id");
|
|
|
//如果链接中包含当前url的信息,两者相匹配
|
|
|
- if (url && url.indexOf(str) >= 0 ) {
|
|
|
+ if (page_id !=null && page_id.toString().length>0 && page_id == current_page_id) {
|
|
|
//激活菜单
|
|
|
$(this).addClass("active");
|
|
|
//如果该菜单是子菜单,则还需要把父菜单打开才行
|
|
|
@@ -21,8 +20,6 @@ $(function(){
|
|
|
$(this).parent('.child-ul').show();
|
|
|
$(this).parent('.child-ul').parent('li').children("a").children('i').attr("class","icon-chevron-down");
|
|
|
};
|
|
|
- //获取对应的page_id
|
|
|
- page_id = $(this).children("a").attr("data-page-id");
|
|
|
if (page_id != '' && page_id !='#') {
|
|
|
change_page(page_id)
|
|
|
};
|