2017-02-16 77 views
1

我使用管理員端的管理員LTE模板。當我轉到其他頁面時,該頁面的按鈕將不會被激活。該按鈕是我的方式觀察到積極的必須也是裏面的李必須 使用jQuery活動按鈕不起作用(ADMIN LTE)

<li class="treeview"> 
    <a href="#"> 
     <i class="fa fa-laptop"></i> 
     <span> Manage Catalog</span> 
     <span class="pull-right-container"> 
      <i class="fa fa-angle-left pull-right"></i> 
     </span> 
    </a> 
    <ul class="treeview-menu"> 
     <li><a href="<?= base_url() .'administrator/products' ?>"><i class="fa fa-circle-o"></i> Products</a></li> 
     <li><a href="pages/UI/icons.html"><i class="fa fa-circle-o"></i> Discount/Promos</a></li> 
    </ul> 
</li> 

回答

0

它首先給ID爲「禮」的標籤,一個實例我該怎麼辦,在icons.html添加productMenu和DiscountMenu

<ul class="treeview-menu"> 
    <li id="productMenu"><a href="<?= base_url() .'administrator/products' ?>"><i class="fa fa-circle-o"></i> Products</a></li> 
    <li id="DiscountMenu"><a href="pages/UI/icons.html"><i class="fa fa-circle-o"></i> Discount/Promos</a></li> 
</ul> 

腳本代碼:

<script> 
    var path = window.location.pathname; 
    if(path.indexOf("icons.html")!==-1){ 
     $("#DiscountMenu").addClass("active"); 
     $("#productMenu").removeClass("active"); 
    } 
</script> 
0

請儘量將

<li class="treeview active"> 
<a href="#"> 
    <i class="fa fa-laptop"></i> 
    <span> Manage Catalog</span> 
    <span class="pull-right-container"> 
     <i class="fa fa-angle-left pull-right"></i> 
    </span> 
</a> 
<ul class="treeview-menu"> 
    <li class="active"><a href="<?= base_url() .'administrator/products' ?>"><i class="fa fa-circle-o"></i> Products</a> 
    </li> 
</ul>