Need to do so that would be the menu closes when you click to another area of the screen, please help, i'm use mootools functions
toggleMenu: function() {
if (menuOpened) {
$('home-menu').setStyle('-webkit-transform', 'translateX(-50px)');
menuOpened = false;
}
else {
$('home-menu').setStyle('-webkit-transform', 'translateX(0px)');
menuOpened = true;
}
},
If I understand you right, you want to close the menu if there is a click outside the menu.
Suggestion (assuming the menu is open):
window.addEvent('click', function (e) {
// this line under will give true if the click is outside the menu
if (e.target.id != 'home-menu' && !e.target.getParent('#home-menu')) myFunctionSpace.toggleMenu();
});