I am currently working on a website where I have implemented a hidden menu that is functioning correctly. However, I want to make it so that when the menu is visible, users can click anywhere on the body to hide it.
Unfortunately, my current code is not working properly and I am getting an error message "Attempting to assign readonly property" while using codeine. This error also causes the entire page to disappear.
In addition to this issue, I am utilizing parallax.js and fullPage.js in this website's design. Below is the segment of code related to this problem:
//function hideMenu {
//var $menu_visivel = $('.menu2').is(":visible");
//if ($menu_visivel) {
//$('body').click(function() {
//});
//} else {
//};
//}
You can view the full Pen and the debug page for further details. Thank you in advance for your help.