Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix: add a way to close user menu when clicking outside it
Browse files Browse the repository at this point in the history
  • Loading branch information
damianmuti committed Mar 18, 2019
1 parent f1fcfd8 commit 88973e9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ $("body").on('click', '.close-user--menu', function() {
$('.user-menu').removeClass('open');
});

$(document).on('mouseup', function(e){
var menu = $(".user-menu");

if (!menu.is(e.target) && menu.has(e.target).length === 0){
menu.removeClass('open');
}
});

// modals
var $delayFade = 500;
//Initialize all modals hidden
Expand Down

0 comments on commit 88973e9

Please sign in to comment.