当前位置:首页 > 资讯 > info6 > 正文

js实现页面跳转菜单选中

发表于: 2015-10-08   作者:chelsi916   来源:转载   浏览:
摘要: KeepAccounts/initializeShiftMahjong"> images/iconfont-jizhang.png"alt=""/> 收银记账 member/view/list"> images/iconfont-huiyuanyingxiao.png"alt=""/> 会员营销 hairstyleDesign/view/toHairstyleDesig
<div class="headerpanel">
    <div class="headerlist">
        <ul>
            <li class="active" role="cashierMenu">
                <a href="<%=topBasePath %>KeepAccounts/initializeShiftMahjong">
                    <div class="img-wrap">
                        <img src="<%=topBasePath %>images/iconfont-jizhang.png" alt=""/>
                    </div>
                    <div>收银记账</div>
                </a>
            </li>
            <li role="membersMenu">
                <a href="<%=topBasePath %>member/view/list">
                    <div class="img-wrap">
                        <img src="<%=topBasePath %>images/iconfont-huiyuanyingxiao.png" alt=""/>
                    </div>
                    <div>会员营销</div>
                </a>
            </li>
            <li role="priceSetMenu">
                <a href="<%=topBasePath %>hairstyleDesign/view/toHairstyleDesign">
                    <div class="img-wrap">
                        <img src="<%=topBasePath %>images/iconfont-jiageshezhi.png" alt=""/>
                    </div>
                    <div>服务设置</div>
                </a>
            </li>
            <li role="employeeMenu">
                <a href="<%=topBasePath %>position/view/positioninfo">
                    <div class="img-wrap">
                        <img src="<%=topBasePath %>images/iconfont-yuangongshezhi.png" alt=""/>
                    </div>
                    <div>员工设置</div>
                </a>
            </li>
            <li role="wechatMenu">
                <a href="<%=topBasePath %>artic/manager">
                    <div class="img-wrap">
                        <img src="<%=topBasePath %>images/iconfont-weimeituoke.png" alt=""/>
                    </div>
                    <div>微美拓客</div>
                </a>
            </li>
            <li role="financialMenu">
                <a href="<%=topBasePath %>">
                    <div class="img-wrap">
                        <img src="<%=topBasePath %>images/iconfont-zhinengbaobiao.png" alt=""/>
                    </div>
                    <div>智能报表</div>
                </a>
            </li>
            <li role="settingMenu">
                <a href="<%=topBasePath %>">
                    <div class="img-wrap">
                        <img src="<%=topBasePath %>images/iconfont-caiwufenxi.png" alt=""/>
                    </div>
                    <div>系统设置</div>
                </a>
            </li>
        </ul>
        <div class="user-info">
            <a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="/page.html">Hi, 欧阳利好! <b class="caret"></b></a>
        </div>
    </div>
</div>

<div class="leftpanel">
    <div class="logo-wrap">
        <img src="<%=menuBasePath %>images/logo.png" alt=""/>
    </div>
    <div class="leftmenu">
         <!-- 服务设置模块 -->
	    <ul class="nav nav-tabs nav-stacked" role="priceSetMenu">
	        <img src="<%=menuBasePath %>images/left-active.png" alt="" class="left-active-img"/>
	        <li class="active" name="toHairstyleDesign" >
	            <a href="<%=menuBasePath %>hairstyleDesign/view/toHairstyleDesign">
	                <div class="img-wrap">
	                    <i class="iconfont icon-xiangmu left-icon"></i>
	                </div>
	                发型设置
	            </a>
	        </li>
	        <img src="<%=menuBasePath %>images/left-active.png" alt="" class="left-active-img hide"/>
	        <li name="projectList" >
	            <a href="<%=menuBasePath %>project/view/projectList">
	                <div class="img-wrap">
	                    <i class="iconfont icon-xiangmu left-icon"></i>
	                </div>
	                项目设置
	            </a>
	        </li>
	        <img src="<%=menuBasePath %>images/left-active.png" alt="" class="left-active-img hide"/>
	        <li name="comboInfoList" >
	            <a href="<%=menuBasePath %>comboInfo/view/comboInfoList">
	                <div class="img-wrap">
	                    <i class="iconfont icon-huli2 left-icon"></i>
	                </div>
	                套餐设置
	            </a>
	        </li>
	        <img src="<%=menuBasePath %>images/left-active.png" alt="" class="left-active-img hide"/>
	        <li name="goodsInfoList" >
	            <a href="<%=menuBasePath %>goodsInfo/view/goodsInfoList">
	                <div class="img-wrap">
	                    <i class="iconfont icon-shangpin-XS left-icon"></i>
	                </div>
	                商品设置
	            </a>
	        </li>
	        <img src="<%=menuBasePath %>images/left-active.png" alt="" class="left-active-img hide"/>
	        <li name="goodsStockList" >
	            <a href="<%=menuBasePath %>goodsInfo/view/goodsStockList">
	                <div class="img-wrap">
	                    <i class="iconfont icon-shangpin-XS left-icon"></i>
	                </div>
	                商品库存
	            </a>
	        </li>
	        <img src="<%=menuBasePath %>images/left-active.png" alt="" class="left-active-img hide"/>
	        <li name="supplierInfoList" >
	            <a href="<%=menuBasePath %>supplierInfo/view/supplierInfoList">
	                <div class="left-content">
	                    <div class="img-wrap">
	                        <i class="iconfont icon-gongyingshang-GL left-icon"></i>
	                    </div>
	                    供应商管理
	                </div>
	            </a>
	        </li>
	    </ul>
    </div>
</div>

<script type="text/javascript">
jQuery(document).ready(function(){
	initMenu();
});

function initMenu(){
	var url = window.location.href;
	jQuery('.left-active-img').addClass('hide');//隐藏其他菜单
	var curLi = jQuery("a[href='" + url + "']").parent();
	curLi.addClass('active').siblings('li').removeClass('active');
	
	var curImg = curLi.prev();
	curImg.removeClass('hide').siblings('img').addClass('hide');
	var curUl = curImg.parent();
	curUl.removeClass('hide').siblings('ul').addClass('hide');;//显示当前地址的菜单
	
	jQuery('.headerlist li').removeClass('active');
	jQuery("li[role='" + curUl.attr('role') + "']").addClass('active');
}
</script>

js实现页面跳转菜单选中

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号