Fixed the javascript behavior of the header menu for mobile devices