Close open menu when clicking again on the button

This commit is contained in:
Slade
2019-11-16 17:57:53 -07:00
committed by Frédéric Guillot
parent 5e6a9a89de
commit 84a4cad9e0
2 changed files with 9 additions and 1 deletions

View File

@@ -10,10 +10,18 @@ Kanboard.Dropdown.prototype.listen = function() {
self.close();
});
$(document).on('click', '.active-dropdown-menu', function() {
$(this).addClass('dropdown-menu');
$(this).removeClass('active-dropdown-menu');
self.close();
});
$(document).on('click', '.dropdown-menu', function(e) {
e.preventDefault();
e.stopImmediatePropagation();
self.close();
$(this).removeClass('dropdown-menu');
$(this).addClass('active-dropdown-menu');
var submenu = $(this).next('ul');
var offset = $(this).offset();