Created
June 5, 2019 14:10
-
-
Save slaffko1/e756cd8f82eb3d68f4476f65725b97df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const $menu = $('.dropdown'); | |
$(document).mouseup(function (e) { | |
if (!$menu.is(e.target) // if the target of the click isn't the container... | |
&& $menu.has(e.target).length === 0) // ... nor a descendant of the container | |
{ | |
$menu.removeClass('is-active'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment