Last active
February 15, 2019 13:54
-
-
Save slavapas/bafd73bcd1c23f0e141521c895d7a9cb to your computer and use it in GitHub Desktop.
Close fropdown by clicking outside of menu jQuery
This file contains hidden or 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
$(document).ready( function(){ | |
$('#trigger').click( function(event){ | |
event.stopPropagation(); | |
$('#drop').toggle(); | |
}); | |
// this is the most important part | |
$(document).click( function(){ | |
$('#drop').hide(); | |
// where #drop is the entire collapsed menu | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment