I have an issue with my main menu on iPhones and possibly android phones. The menu width is set to 100vw up to 600px. However, on a 320px or 480px screen, when the menu button is clicked and when one enters the page, the page zooms out a little bit every time.
The menu is configured with simple javascript, that looks like this:
/**
* navigation.js
*
* Handles toggling the navigation menu for small screens.
*/
( function() {
var nav = document.getElementById( 'site-navigation' ), button, menu;
if ( ! nav )
return;
button = nav.getElementsByTagName( 'h3' )[0];
menu = nav.getElementsByTagName( 'ul' )[0];
if ( ! button )
return;
// Hide button if menu is missing or empty.
if ( ! menu || ! menu.childNodes.length ) {
button.style.display = 'none';
return;
}
button.onclick = function() {
if ( -1 == menu.className.indexOf( 'nav-menu' ) )
menu.className = 'nav-menu';
if ( -1 != button.className.indexOf( 'toggled-on' ) ) {
button.className = button.className.replace( ' toggled-on', '' );
menu.className = menu.className.replace( ' toggled-on', '' );
} else {
button.className += ' toggled-on';
menu.className += ' toggled-on';
}
};
} )();
The page works fine on a 320px browser window on a computer, so I guess the problem is device-specific.
I am using the standard Wordpress theme Twentytwelve, and the page can be found here:
I would appriciate any suggestion!
/Stilius