Hari Shanker

Hari Shanker

  • NA
  • 260
  • 34k

How to Make the Sub menu of accordion active after redirect

Jan 11 2017 2:52 AM
Hi,
 
I want my sub menu active when ever i am clicking the sub menu and redirecting to another page using html and jquery.
 
but here in my case it is getting collapse.please do advise..here is my js and css
 
$(document).ready(function () {
$("#accordion > li > div").click(function () {
if (false == $(this).next().is(':visible')) {
$('#accordion ul').slideUp(300);
}
$(this).next().slideToggle(300);
});
$('.sub-menu1').click(function () {
$('ul:eq(0)').show();
});
 
 
 
 
<div class="menu" style="display: inline-block; width: 20%; vertical-align: top; border: 1px solid #000000; min-height: 545px;">
<ul id="accordion">
<li>
<div>Masters</div>
<ul class="sub-link">
<li class="sub-link1"><a class="sub-menu1" href="@Url.Action("ShowAllItemTypes", "Master")">Item Type</a></li>
</ul>
</li>
<li>
<div>Search</div>
<ul>
<li><a class="sub-menu1" href="#">Search</a></li>
</ul>
</li>
<li>
<div>Tasks</div>
<ul>
<li><a class="sub-menu1" href="#">Tasks</a></li>
</ul>
</li>
<li>
<div>Reports</div>
<ul>
<li><a class="sub-menu1" href="#">Reports</a></li>
</ul>
</li>
<li>
<div>Configuration</div>
<ul>
<li><a class="sub-menu1" href="#">Configuration</a></li>
</ul>
</li>
</ul>
 
 
Regards,
Hari 
 
 
 
 

Answers (3)