How to stop your navigation bar from resetting to its initial state - php

I am trying to add active styling to the clicked link in the navbar and navigate to another page. But whenever I click on a link, it loads the page but resets the style of navbar. I tried using e.preventDefault, but it only ends up stopping the other pages to load but allows the style to show up on the nav bar. WheBelow are the code snippets
(function (window, document, $, undefined) {
"use strict";
$(document).ready(function () {
$(".c-header-1.-bg-white .c-header-1-nav > ul > li > a").click(function (
e
) {
$(
".c-header-1.-bg-white .c-header-1-nav > ul > li > a.active"
).removeClass("active");
// var $parent = $(this).parent();
$(this).addClass("active");
e.preventDefault();
});
});
})(window, document, jQuery);
/* Enter your custom styles */
#media (min-width: 992px) {
.c-header-1.-bg-white .c-header-1-nav > ul > li > a.active {
color: #0c2840;
}
.c-header-1.-bg-white .c-header-1-nav > ul > li > a.active:before {
background-color: #0c2840;
visibility: visible;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<header class="c-header-1 -bg-white -js-header">
<div class="c-header-1-spacer"></div>
<div class="c-header-1-container">
<div class="c-header-1-inner">
<div class="c-container">
<div class="c-header-1-middle">
<div class="c-header-1-logo">
<img src="assets/img/logo.png" alt="Victoria Property Management Logo">
</div>
<nav class="c-header-1-nav">
<ul>
<li>
Home
</li>
<li>
About
</li>
<li>
Services
</li>
<li>
Gallery
</li>
<li>
Contact
</li>
</ul>
</nav>
<div class="c-header-1-icon-toggle">
<span class="ion-navicon-round"></span>
</div>
<div class="c-header-1-btn">
(503) 317-7676
</div>
<div class="c-header-1-btn c-social-1 -color-mixed-simple -hover-mixed-outline -size-small">
<ul class="c-social-1-inner">
<li class="c-social-1-item">
<a class="c-social-1-link -icon-instagram" href="https://www.instagram.com/sierraallegretto/" target="_blank">
<i class="fa fa-instagram" aria-hidden="true"></i>
</a>
</li>
<li class="c-social-1-item">
<a class="c-social-1-link -icon-linkedin" href="https://www.linkedin.com/in/sierraallegretto/" target="_blank">
<i class="fa fa-linkedin" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</header>

Related

Bootstrap navbar logo in the center and items to the left und right

I try to make a proper navbar with bootstrap.
I tried to make a logo in the center and the rest on the left and on the right.
The current solution is unclean and I ask you for an adivce, how to fix it.
Problem: It's not the same length to the left/right object from the logo AND the logo is not perfect centered.
[Navbar][1]
Current html:
<nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top">
<div class="container">
<button class="navbar-toggler" data-toggle="collapse" data-target="#navbarMenu">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarMenu">
<ul class="navbar-nav mr-auto">
<li class="nav-item">Status</li>
<li class="nav-item">Download</li>
<li class="nav-item">Teamspeak</li>
<li class="nav-item">Teamspeak</li>
</ul>
<a class="navbar-brand" href="#">
<img src="/img/helmet.png" height="100" with="50" alt="">
</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item">Teamspeak Bot</li>
<li class="nav-item">Travel</li>
<li class="nav-item">Plex</li>
<li class="nav-item">Contact</li>
</ul>
</div>
</div>
</nav>
CSS
.collapse.navbar-collapse ul{
margin: auto;
}
.navbar-brand {
position: absolute;
top: 0;
left: 50%;
text-align: center;
margin: auto;
font-size: 36px;
}
.bg-dark {
background:transparent !important;
background-image: url("/img/navbar.png") !important;
min-height: 70px;
}
You can use pull-right class to align the items to the right, but it need few more modifications to work correctly.I have created a clean solution with the links that you provided.Enjoy!
body { background-color: blueviolet !important; }
.navbar {
position: relative;
top:10px;
}
.brand {
position: absolute;
left: 50%;
margin-left: -50px !important;
display: block;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js"></script>
<!--If you want to add background image add it to the class below-->
<div class="container-fluid"><!--add this line-->
<div class="row"><!--add this line-->
<div class="col-md-12"><!--add this line-->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="brand" style="margin: 0; float: none;" href="#">
<!--add logo source-->
<img src="icon.png" alt="logo" title="logo" height="100" with="50" />
</a>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">Status</li>
<li class="nav-item">Download</li>
<li class="nav-item">Teamspeak</li>
<li class="nav-item">Teamspeak</li>
</ul>
<ul class="navbar-nav pull-right">
<li class="nav-item">Teamspeak Bot</li>
<li class="nav-item">Travel</li>
<li class="nav-item">Plex</li>
<li class="nav-item">Contact</li>
</ul>
</div>
</div>
</nav>
</div><!--add this line-->
</div><!--add this line-->
<!--New Row for the main content-->
<div class="row">
<div class="col-md-12">
<!--Main content-->
</div>
</div>
</div><!--add this line-->
Change class on second tag to ml-auto since the right side pane must be aligned with margin on the left. This should fix it.
<nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top">
<div class="container">
<button class="navbar-toggler" data-toggle="collapse" data-target="#navbarMenu">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarMenu">
<ul class="navbar-nav mr-auto">
<li class="nav-item">Status</li>
<li class="nav-item">Download</li>
<li class="nav-item">Teamspeak</li>
<li class="nav-item">Teamspeak</li>
</ul>
<a class="navbar-brand" href="#">
<img src="/img/helmet.png" height="100" with="50" alt="">
</a>
<ul class="navbar-nav ml-auto"> <!-- change here -->
<li class="nav-item">Teamspeak Bot</li>
<li class="nav-item">Travel</li>
<li class="nav-item">Plex</li>
<li class="nav-item">Contact</li>
</ul>
</div>
</div>
</nav>

Add Active Class to sidebar Item Based on URL

I am using laravel and when the page is refresh the active item on sidebar is not selected, this : li class="{{ (request()->is('admin/cities*')) ? 'active' : '' }}"> (is a easy solution), but not looks great. How i can make this using jquery or other?
$(document).ready(function() {
$('ul li a').click(function() {
$('li a').removeClass("active");
$(this).addClass("active");
});
});
<style>.sidebar-link.active,
.sidebar-link:focus {
background: #e2e8ed;
color: grey !important;
text-decoration: none;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="sidebar" class="sidebar py-3">
<ul class="sidebar-menu list-unstyled">
<li class="sidebar-list-item"><a href="/test" class="sidebar-link text-
muted active"><i class="la la-dashboard mr-3 text-gray "></i>
<span>Dashboard</span></a>
</li>
<li class="sidebar-list-item"><a href="/test2" class="sidebar-link text-
muted"><i class="la la-dashboard mr-3 text-gray "></i>
<span>Test</span></a>
</li>
<ul>
</div>

How can I darken the background when a linked is clicked?

I am currently working on the navbar of my website.
There are five elements on my navbar and I'd like to make an element darker when it is clicked.
These is what I've tried so far:
jQuery to change the active element:
<script type="text/javascript">
$(function(){
$('nav navbar-nav a').filter(function(){return this.href==location.href}).parent().addClass('active').siblings().removeClass('active')
$('nav navbar-nav a').click(function(){
$(this).parent().addClass('active').siblings().removeClass('active')
})
})
</script>
The five elements on the navbar:
<nav class = "navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse"data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Intern Web</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active">About</li>
<li>News</li>
<li>Intern</li>
<li>Form</li>
</ul>
This is a screenshot of the website:
But it seems to not be working, only About is selected every single time.
Any ideas? Thanks a lot.
<script type="text/javascript">
$(function(){
$(".navbar-nav li a").on('click',function(){
$(nav-bar-nav li).toggleClass("active");
});
});
<ul class="nav navbar-nav">
<li class="">About</li> /*Just remove active class and add with js*/
<li>News</li>
<li>Intern</li>
<li>Form</li>
</ul>
.active{
background:black;
}
.active a{
color:#ffffff;
}
Use code as below:
DO NOT forget . before className in JQuery:
$('.nav .navbar-nav a') instaed $('nav navbar-nav a')
$('.navbar-nav li a').click(function(){
$(".navbar-nav li").removeClass("active");
$(this).parent().addClass("active");
});
.active{
background:black;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<nav class = "navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse"data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Intern Web</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active">About</li>
<li>News</li>
<li>Intern</li>
<li>Form</li>
</ul>
I Guess You are probably providing the wrong selector to jQuery
$('div.nav li a').click(function(){
$(this).parent().addClass('active').siblings().removeClass('active')
})
})
The Selectors
$("nav li a") or $(".navbar-nav li a")
Should work fine
Simply remove the active class on the li's on the click and then assign it to the li that was clicked:
$('.navbar-nav li').click(function(){
$('.navbar-nav li').removeClass('active');
$(this).addClass('active')
})
.navbar-nav li {
list-style: none;
display: inline;
padding: 5px 10px;
background: #d4d4d4;
}
.navbar-nav li a {
color: #222;
text-decoration: none;
}
.navbar-nav li.active {
background: black;
}
.navbar-nav li.active a {
color: white;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul class="nav navbar-nav">
<li class="active">About</li>
<li>News</li>
<li>Intern</li>
<li>Form</li>
</ul>

How to Keep the parent menu highlighted when I click on its child menu

I am using the following jquery
<script>
$(document).ready(function () {
$('#menu-wplook-main-menu').find('li a').click(function () {
$('#menu-wplook-main-menu').find('li a').removeClass('active');
$(this).addClass('active');
$($(this)
.closest('li.menu-item')
.children()[0]).addClass('active');
});
});
</script>
My css
<style>
#menu-wplook-main-menu li a.active {
color:#e53b51;
background: blue;
}
</style>
My html
<ul class="nav nav-tabs" role="tablist" id="menu-wplook-main-menu" >
<li role="presentation">
<a class="dropdown-toggle has-submenu cursor_pointer" href="index.php"> Home </a>
</li>
<li role="presentation menuli menulixl root" class="menu-item">
<a class="dropdown-toggle has-submenu cursor_pointer cursor_pointer" href=""> Services <span class="sub-arrow"></span> </a>
<ul class="dropdown-menu multimenu multimenuxl vbghno sm-nowrap" style="min-width: 10em; max-width: 40em; top: auto; left: 0px; margin-left: -117px; width: auto; margin-top: -1px;">
<li class="col-xs-12">
<!--<a class="splhed" href="">Software Development</a>-->
<a class="levelmenu" href="trav_port.php">Travel Portal Development</a>
<a class="levelmenu" href="GDS_integ.php">GDS Integrations</a>
<a class="levelmenu" href="xml_api_integ.php">XML/API Integrations</a>
<a class="levelmenu" href="white_label_web.php">White Label Website</a>
<a class="levelmenu" href="Hotel_Cab_portal.php">Hotel & Cab Portal Development</a>
<a class="levelmenu" href="travel_web.php">Travel Website Designing</a>
<a class="levelmenu" href="mobile_app_dev.php">Mobile Apps Development</a>
</li>
</ul>
</li>
<li role="presentation" class="menu-item">
<a class="dropdown-toggle has-submenu cursor_pointer" href=""> Products <span class="sub-arrow cursor_pointer"></span> </a>
<ul class="dropdown-menu multimenu multimenuxl vbghno sm-nowrap" style="min-width: 10em; max-width: 40em; top: auto; left: 0px; margin-left: -117px; width: auto; margin-top: -1px;">
<li class="col-xs-12">
<a class="levelmenu" href="trav_portal.php">Travel Portal</a>
<a class="levelmenu" href="travsoft.php">Travsoft</a>
<a class="levelmenu" href="white_label.php">White label</a>
<a class="levelmenu" href="hotel_extranet.php">Hotel Extranet</a>
<a class="levelmenu" href="holiday_manage.php">Holiday Management System</a>
<a class="levelmenu" href="hotrl_crs.php">Hotel CRS</a>
</li>
</ul>
</li>
</ul>
If I do not use the PHP link in href it works perfectly. But if I use the PHP link in href it is not working.
Question
Should I change anything in my PHP file?
It seems to be working fine. Your jQuery could be a bit cleaned up. For example:
$('#menu-wplook-main-menu li a').click(function () {
$('#menu-wplook-main-menu .active').removeClass('active');
$(this).addClass('active');
$(this).closest('li.menu-item').children().first().addClass('active');
});
But I think you main problem is that when clicking your links you navigate to a new page. So you reload the whole menu, and have no state of it left. and start from scratch.
You would need a function perhaps that will take your page from current address, look for the menu item and highlight it.
If you replace all your .php links with #1, #2 etc it works fine.
So either a load function, or load stuff with ajax maybe.
Try this :
$(document).ready(function(){
$(".dropdown-menu a").on("click",function(){
$(".dropdown-toggle").removeClass("active");
$(this).closest(".menu-item").find(".dropdown-toggle").addClass("active");
})
})
Final code :
i change href to # for test :
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<style>
.active {
color:#e53b51;
background: blue;
}
</style>
My html
<ul class="nav nav-tabs" role="tablist" id="menu-wplook-main-menu" >
<li role="presentation">
<a class="dropdown-toggle has-submenu cursor_pointer" href="index.php"> Home </a>
</li>
<li role="presentation menuli menulixl root" class="menu-item">
<a class="dropdown-toggle has-submenu cursor_pointer cursor_pointer" href=""> Services
<span class="sub-arrow"></span>
</a>
<ul class="dropdown-menu multimenu multimenuxl vbghno sm-nowrap" style="min-width: 10em; max-width: 40em; top: auto; left: 0px; margin-left: -117px; width: auto; margin-top: -1px;">
<li class="col-xs-12">
<!--<a class="splhed" href="">Software Development</a>-->
<a class="levelmenu" href="#">Travel Portal Development</a>
<a class="levelmenu" href="#">GDS Integrations</a>
<a class="levelmenu" href="#">XML/API Integrations</a>
<a class="levelmenu" href="#">White Label Website</a>
<a class="levelmenu" href="#">Hotel & Cab Portal Development</a>
<a class="levelmenu" href="#">Travel Website Designing</a>
<a class="levelmenu" href="#">Mobile Apps Development</a>
</li>
</ul>
</li>
<li role="presentation" class="menu-item">
<a class="dropdown-toggle has-submenu cursor_pointer" href=""> Products <span class="sub-arrow cursor_pointer"></span> </a>
<ul class="dropdown-menu multimenu multimenuxl vbghno sm-nowrap" style="min-width: 10em; max-width: 40em; top: auto; left: 0px; margin-left: -117px; width: auto; margin-top: -1px;">
<li class="col-xs-12">
<a class="levelmenu" href="#">Travel Portal</a>
<a class="levelmenu" href="#">Travsoft</a>
<a class="levelmenu" href="#">White label</a>
<a class="levelmenu" href="#">Hotel Extranet</a>
<a class="levelmenu" href="#">Holiday Management System</a>
<a class="levelmenu" href="#">Hotel CRS</a>
</li>
</ul>
</li>
</ul>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".dropdown-menu a").on("click",function(){
$(".dropdown-toggle").removeClass("active");
$(this).closest(".menu-item").find(".dropdown-toggle").addClass("active");
})
})
</script>
</body>
</html>

How to add bootstrap class active in codeigniter

i want to know how to add class active in codeigniter when we separate the view into 3 file. such as :
header.php
page1.php ... page10.php
footer.php
from this thread, there's no way how to do it when separated the view.
this my header look like:
<body class="skin-red">
<div class="wrapper">
<header class="main-header">
</header>
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="<?php echo base_url();?>assets/dist/img/admin.png" class="img-circle" alt="User Image" />
</div>
<div class="pull-left info">
<p>Username</p>
<small>Privilage</small>
</div>
</div>
<!-- search form -->
<!-- /.search form -->
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu" id="sidebar">
<li class="header">MAIN NAVIGATION</li>
<li class="treeview">
<a href="#">
<i class="fa fa-users"></i> <span>Users</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li><i class="fa fa-chevron-right"></i>User List</li>
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-hospital-o"></i> <span>Provider</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li><i class="fa fa-chevron-right"></i>Provider List</li>
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-book"></i> <span>Product Info</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li><i class="fa fa-chevron-right"></i>List Product Info</li>
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-book"></i> <span>Procedure</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li><i class="fa fa-headphones"></i>Procedure List</li>
<!-- <li><i class="fa fa-user"></i>Link Customer Portal</li> -->
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-film"></i> <span>Video Upload</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li><i class="fa fa-chevron-right"></i>Video Data</li>
<!-- <li><i class="fa fa-chevron-right"></i>Prosedur</li> -->
<!-- <li><i class="fa fa-chevron-right"></i>Informasi NAB</li> -->
<!-- <li><i class="fa fa-chevron-right"></i>Demo(Video)</li> -->
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-camera-retro"></i> <span>Slide Show Wallpaper</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li><i class="fa fa-chevron-right"></i>Slide Show Data</li>
<!-- <li><i class="fa fa-chevron-right"></i>Prosedur</li> -->
<!-- <li><i class="fa fa-chevron-right"></i>Informasi NAB</li> -->
<!-- <li><i class="fa fa-chevron-right"></i>Demo(Video)</li> -->
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-camera-retro"></i> <span>Examples</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li><i class="fa fa-chevron-right"></i>Login</li>
</ul>
</li>
</ul>
</section>
<!-- /.sidebar -->
</aside>
</div>
</body>
to access the content, this is the how i do:
<section class="content">
.....
</section>
and this my footer view:
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Version</b> 2.0
</div>
<strong>Copyright © 2014-2015</strong> All rights reserved.
</footer>
</div><!-- ./wrapper -->
<script></script>
<script></script>
</body>
</html>
i want to made,when user click the treeview submenu it will become active,
right know when i click the treeview submenu. it will reload not become active.
in sample i downloaded AdminLTE active class define in each submenu page, such as menu - <li class="active">submenu</li>
regards,
bobby
cmiiw
================================================
i found the js code, it is in. app.js.
$.AdminLTE.tree = function (menu) {
var _this = this;
$("li a", $(menu)).click(function (e) {
//Get the clicked link and the next element
var $this = $(this);
var checkElement = $this.next();
//Check if the next element is a menu and is visible
if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible'))) {
//Close the menu
checkElement.slideUp('normal', function () {
checkElement.removeClass('menu-open');
//Fix the layout in case the sidebar stretches over the height of the window
//_this.layout.fix();
});
checkElement.parent("li").removeClass("active");
}
//If the menu is not visible
else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
//Get the parent menu
var parent = $this.parents('ul').first();
//Close all open menus within the parent
var ul = parent.find('ul:visible').slideUp('normal');
//Remove the menu-open class from the parent
ul.removeClass('menu-open');
//Get the parent li
var parent_li = $this.parent("li");
//Open the target menu and add the menu-open class
checkElement.slideDown('normal', function () {
//Add the class active to the parent li
checkElement.addClass('menu-open');
parent.find('li.act').addClass('active');
// parent_li.addClass('active');
//Fix the layout in case the sidebar stretches over the height of the window
_this.layout.fix();
});
}
//if this isn't a link, prevent the page from being redirected
if (checkElement.is('.treeview-menu')) {
e.preventDefault();
}
});
};
here's the first schema of the layout.
in page.A <li> was active so page.B, when i click one of the it become active.
after slicing the page into codeigniter way, i separate into 3: header,content(body),and footer.
i remove all the class in tag <li>..
i try to modify like thie below:
checkElement.addClass('menu-open');
parent.find('li').on('click', function(){
$(this).addClass('active');
});
it wont work,
wonder if u guys had a ways.
sorry for my bad english :-D
It is easy and work properly
$(document).ready(function(e){
var url=window.location
$('.treeview-menu a').each(function(e){
var link = $(this).attr('href');
if(link==url){
$(this).parent('li').addClass('active');
$(this).closest('.treeview').addClass('active');
}
});
});
Try preventDefault()
$('.treeview').on('click', function(e) {
e.preventDefault();
});
try this code
Put below code before body tag ends
$(document).ready(function(e){
$('.treeview a').each(function(e){
var pathname = window.location.pathname.split("/");
var url= pathname[pathname.length-1];
var link = $(this).attr('href');
if(link==url){$(this).parent('li').addClass('active');}
});
});
and where it is written " $("li a", $(menu)).click(function (e) {"
put below line after it
$('.treeview .active').removeClass('active');
e.preventDefault();
$(this).addClass('active');

Categories