Make menu close on click outside of menu container.
The menu was closing fine on click of the Options button, but now it does not because I added some code to close it on click of the outside of container, and this is currently the only way to close it. I need to close it both ways. Can anyone help?
My code:
<script type="text/javascript">
jQuery(document).ready(function($) {
$('.bbp-admin-links:even').css({position: 'absolute', right: '380px'});
$('.bbp-meta ul.bbp_custom_links_menu li.parent > a').click(function(e) {
$(this).next('.bbp_custom_links_submenu').toggle();
e.preventDefault();
});
$(document).mouseup(function(e) {
if ($(e.target).closest('.bbp_custom_links_submenu').length === 0) {
// Not within the container
$('.bbp_custom_links_submenu').hide();
}
});
});
</script>
Hello,
This is the full code in my WordPress themes functions.php file if you need it. Same jQuery as posted in my last reply, it is the working version.