I want to close the re-sized menu when one clicks anywhere on the page. I've searched various stack overflow answers but haven't found one that does not interfere with the menu code itself, my menu...
jQuery(document).ready(function($) {
//open-close submenu on mobile
$('.cd-main-nav').on('click', function(event) {
if ($(event.target).is('.cd-main-nav'))
$(this).children('ul').toggleClass('is-visible0');
});
//i have tried adding this but hasn't worked
$('html').click(function() {
if ($('.cd-main-nav').children('ul').hasClass('is-visible0')) $(this).children('ul').toggleClass('is-visible0');
});
});