Search This Blog

Thursday, March 17, 2016














Step1:

We have already have the script for the Side - navigation and toggle effect...

We faced a problem,, when selecting  the particular item it should be highlight on current item,
What we did was .... giving the class name active  to respected pages (statically)...

Step2:

As of all the menus are static... we have to  highlight the active class on clicking...

so i have added the hand code jquery script and highlighted the items....

Step3:

HTML COde:

 <section style="height: auto;" class="sidebar">       
      <!-- sidebar menu div starts here -->
      <ul class="sidebar-menu">
        <li><a href="#"><i class="fa fa-calendar"></i> <span>Inspections Schedule</span></a></li>
        <li class="treeview"> <a href="#"> <i class="fa fa-pencil-square-o"></i> <span>Inspection Forms</span> <i class="fa fa-angle-left pull-right"></i> </a>
          <ul style="display: none;" class="treeview-menu">
            <li><a href="#">Add Templates </a></li>
            <li><a href="#">View Form Templates </a></li>
             <li><a href="#"> View Submitted Forms</a></li>
          </ul>
        </li>
        <li class="treeview"> <a href="#"> <i class="fa fa-user"></i> <span>Manage User</span> <i class="fa fa-angle-left pull-right"></i> </a>
          <ul style="display: none;" class="treeview-menu">
             <li><a href="#">View Users</a></li>
            <li><a href="#">Add Users</a></li>
            <li ><a href="#"> User Roles</a></li>
          </ul>
        </li>
        <li><a href="#"><i class="fa fa-book"></i> <span>Reports</span></a></li>
      </ul>
    </section>

Step4:

Sidebar-menu contains parent and child ul class="Sidebar-menu" >  li  > ul  > li



First UL contain class name Sidebar-menu...

So we have to add and remove active class for the first set  ul li  using class name Sidebar-menu.





<script>
$(document).ready(function(e) {
    $('.sidebar-menu li').on('click', function()
    {
        
         $('.sidebar-menu li.active').removeClass('active');
      
    $(this).first().addClass('active');
    });
});
</script>



Step4:

Treeview-menu contains second  ul  class="Treeview-menu" > li

Second UL contain class name Treeview-menu
 
<script>
 
$(document).ready(function(e) {
    $('.treeview-menu li').on('click', function()
    {
         $('.treeview-menu li.current-active').removeClass('current-active');
      
        $(this).addClass('current-active');
    });
});
</script>

Step5:

one important thing... you should not use both active class  for Two UL..

you have keep one for current-active



 <style>
.current-active
{
    background-color: #00c0ef;
    color:#fff;
}
.current-active li a
{

    color:#fff;
}
.skin-blue .treeview-menu > li > a
{
    color:#fff;
}
</style>



 









No comments:

Post a Comment

Validating to select in sequencial order using angular

    < input type = "checkbox" (change) = "handleSelectTaskItem($event, taskItem)" [checked] = " taskItem . i...