Updated code for mobile dropdown menu to hide when clicked outside