Skip to content

Commit

Permalink
fix sidebar-menu nav-item dropdown always open
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarlopes authored Jun 28, 2019
1 parent ab90493 commit 7dc6210
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions assets/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,28 @@ $(function() {
sidebar_nicescroll = $(".main-sidebar").getNiceScroll();

$(".main-sidebar .sidebar-menu li a.has-dropdown").off('click').on('click', function() {
var me = $(this);

var me = $(this);
var active = false;
if(me.parent().hasClass("active")){
active = true;
}

$('.main-sidebar .sidebar-menu li.active > .dropdown-menu').slideUp(500, function() {
update_sidebar_nicescroll();
update_sidebar_nicescroll();
return false;
});

$('.main-sidebar .sidebar-menu li.active').removeClass('active');

if(me.parent().hasClass("active")) {
me.parent().removeClass('active');

me.parent().find('> .dropdown-menu').slideUp(500, function() {
if(active==true) {
me.parent().removeClass('active');
me.parent().find('> .dropdown-menu').slideUp(500, function() {
update_sidebar_nicescroll();
return false;
});
}else{
me.parent().addClass('active');

me.parent().find('> .dropdown-menu').slideDown(500, function() {
me.parent().addClass('active');
me.parent().find('> .dropdown-menu').slideDown(500, function() {
update_sidebar_nicescroll();
return false;
});
Expand All @@ -117,7 +120,7 @@ $(function() {
});

$('.main-sidebar .sidebar-menu li.active > .dropdown-menu').slideDown(500, function() {
update_sidebar_nicescroll();
update_sidebar_nicescroll();
return false;
});
}
Expand Down

0 comments on commit 7dc6210

Please sign in to comment.