Non-responsive menu
-
Most themes that exist nowadays have a so-called “responsive” layout, including a menu. Unfortunately, the menu in this theme breaks down as the screen size gets small.
Is it possible that a simple responsive menu can be added? It was talked about here https://www.ads-software.com/support/topic/mobile-navigation-5?replies=4, but there was no real solution discussed (plus the website doesn’t seem to be working to even investigate).
I could add an issue on GitHub if it’s worth it…
-
add this to functions.php:
add_action(‘wp_head’,’mobile_styles’);
/**
* Add mobile stylesheet
*
*/
function mobile_styles() { ?>
<link href=”<?php bloginfo(‘stylesheet_directory’);?>/small-devices.css” media=”only screen and (max-width: 480px), only screen and (max-device-width: 480px)” rel=”stylesheet” type=”text/css”/><?php }
Create this the file: small-devices.css:
@media screen and (max-width: 768px) { /* GeneratePress specific */ .menu-toggle, .main-navigation.toggled .main-nav > ul { display: block; } .main-navigation ul li:hover > ul { display: none; } .sf-menu li:hover > ul, .sf-menu li.sfHover > ul { display: none; } .sub-menu.toggled-on, .children.toggled-on { display: block !important; } .main-navigation .main-nav ul li .dropdown-toggle { display: block; } .main-navigation li a.dropdown-toggle { position: absolute; top: 0; right: 0; } .main-navigation ul { display: none; } .nav-float-right .main-navigation { float: none; margin-bottom:20px; } .site-main { margin-left: 0 !important; margin-right: 0 !important; margin-bottom: 0 !important; } .fluid-header .inside-header { text-align: center; } .menu-toggle { text-align: center; } .main-nav .sf-menu > li { float: none; } .nav-aligned-right.nav-below-header .main-navigation .menu > li, .nav-aligned-right.nav-below-header .main-navigation .sf-menu > li, .nav-aligned-right.nav-above-header .main-navigation .menu > li, .nav-aligned-right.nav-above-header .main-navigation .sf-menu > li, .nav-aligned-center.nav-below-header .main-navigation .menu > li, .nav-aligned-center.nav-below-header .main-navigation .sf-menu > li, .nav-aligned-center.nav-above-header .main-navigation .menu > li, .nav-aligned-center.nav-above-header .main-navigation .sf-menu > li { display: block; margin: 0; text-align: left; } .main-navigation .main-nav ul ul { position: relative; top: 0; left: 0; width: 100%; } .inside-footer-widgets > div { margin-bottom: 50px; } .header-widget { float: none; max-width: 100%; text-align: center; } .main-navigation, .main-navigation { text-align:left; } .navigation-search, .navigation-search input { width: 100%; max-width: 100%; } .main-navigation li.search-item { z-index: 19; } .main-navigation li.search-item .fa-times { text-indent: -9999px; } .alignleft, .alignright { float: none; display: block; margin-left: 0; margin-right: 0; } .main-navigation li.search-item.current-menu-item { position: relative !important; right: auto; } .post-image-aligned-left .post-image, .post-image-aligned-right .post-image { float: none; margin: 2em 0; text-align: center; } /* Unsemantic Framework*/ .mobile-grid-100:before, .mobile-grid-100:after { content: "."; display: block; overflow: hidden; visibility: hidden; font-size: 0; line-height: 0; width: 0; height: 0; } .mobile-grid-100:after { clear: both; } .mobile-push-5, .mobile-pull-5, .mobile-push-10, .mobile-pull-10, .mobile-push-15, .mobile-pull-15, .mobile-push-20, .mobile-pull-20, .mobile-push-25, .mobile-pull-25, .mobile-push-30, .mobile-pull-30, .mobile-push-35, .mobile-pull-35, .mobile-push-40, .mobile-pull-40, .mobile-push-45, .mobile-pull-45, .mobile-push-50, .mobile-pull-50, .mobile-push-55, .mobile-pull-55, .mobile-push-60, .mobile-pull-60, .mobile-push-65, .mobile-pull-65, .mobile-push-70, .mobile-pull-70, .mobile-push-75, .mobile-pull-75, .mobile-push-80, .mobile-pull-80, .mobile-push-85, .mobile-pull-85, .mobile-push-90, .mobile-pull-90, .mobile-push-95, .mobile-pull-95, .mobile-push-33, .mobile-pull-33, .mobile-push-66, .mobile-pull-66 { position: relative; } .hide-on-mobile { display: none !important; } .mobile-grid-5 { float: left; width: 5%; } .mobile-prefix-5 { margin-left: 5%; } .mobile-suffix-5 { margin-right: 5%; } .mobile-push-5 { left: 5%; } .mobile-pull-5 { left: -5%; } .mobile-grid-10 { float: left; width: 10%; } .mobile-prefix-10 { margin-left: 10%; } .mobile-suffix-10 { margin-right: 10%; } .mobile-push-10 { left: 10%; } .mobile-pull-10 { left: -10%; } .mobile-grid-15 { float: left; width: 15%; } .mobile-prefix-15 { margin-left: 15%; } .mobile-suffix-15 { margin-right: 15%; } .mobile-push-15 { left: 15%; } .mobile-pull-15 { left: -15%; } .mobile-grid-20 { float: left; width: 20%; } .mobile-prefix-20 { margin-left: 20%; } .mobile-suffix-20 { margin-right: 20%; } .mobile-push-20 { left: 20%; } .mobile-pull-20 { left: -20%; } .mobile-grid-25 { float: left; width: 25%; } .mobile-prefix-25 { margin-left: 25%; } .mobile-suffix-25 { margin-right: 25%; } .mobile-push-25 { left: 25%; } .mobile-pull-25 { left: -25%; } .mobile-grid-30 { float: left; width: 30%; } .mobile-prefix-30 { margin-left: 30%; } .mobile-suffix-30 { margin-right: 30%; } .mobile-push-30 { left: 30%; } .mobile-pull-30 { left: -30%; } .mobile-grid-35 { float: left; width: 35%; } .mobile-prefix-35 { margin-left: 35%; } .mobile-suffix-35 { margin-right: 35%; } .mobile-push-35 { left: 35%; } .mobile-pull-35 { left: -35%; } .mobile-grid-40 { float: left; width: 40%; } .mobile-prefix-40 { margin-left: 40%; } .mobile-suffix-40 { margin-right: 40%; } .mobile-push-40 { left: 40%; } .mobile-pull-40 { left: -40%; } .mobile-grid-45 { float: left; width: 45%; } .mobile-prefix-45 { margin-left: 45%; } .mobile-suffix-45 { margin-right: 45%; } .mobile-push-45 { left: 45%; } .mobile-pull-45 { left: -45%; } .mobile-grid-50 { float: left; width: 50%; } .mobile-prefix-50 { margin-left: 50%; } .mobile-suffix-50 { margin-right: 50%; } .mobile-push-50 { left: 50%; } .mobile-pull-50 { left: -50%; } .mobile-grid-55 { float: left; width: 55%; } .mobile-prefix-55 { margin-left: 55%; } .mobile-suffix-55 { margin-right: 55%; } .mobile-push-55 { left: 55%; } .mobile-pull-55 { left: -55%; } .mobile-grid-60 { float: left; width: 60%; } .mobile-prefix-60 { margin-left: 60%; } .mobile-suffix-60 { margin-right: 60%; } .mobile-push-60 { left: 60%; } .mobile-pull-60 { left: -60%; } .mobile-grid-65 { float: left; width: 65%; } .mobile-prefix-65 { margin-left: 65%; } .mobile-suffix-65 { margin-right: 65%; } .mobile-push-65 { left: 65%; } .mobile-pull-65 { left: -65%; } .mobile-grid-70 { float: left; width: 70%; } .mobile-prefix-70 { margin-left: 70%; } .mobile-suffix-70 { margin-right: 70%; } .mobile-push-70 { left: 70%; } .mobile-pull-70 { left: -70%; } .mobile-grid-75 { float: left; width: 75%; } .mobile-prefix-75 { margin-left: 75%; } .mobile-suffix-75 { margin-right: 75%; } .mobile-push-75 { left: 75%; } .mobile-pull-75 { left: -75%; } .mobile-grid-80 { float: left; width: 80%; } .mobile-prefix-80 { margin-left: 80%; } .mobile-suffix-80 { margin-right: 80%; } .mobile-push-80 { left: 80%; } .mobile-pull-80 { left: -80%; } .mobile-grid-85 { float: left; width: 85%; } .mobile-prefix-85 { margin-left: 85%; } .mobile-suffix-85 { margin-right: 85%; } .mobile-push-85 { left: 85%; } .mobile-pull-85 { left: -85%; } .mobile-grid-90 { float: left; width: 90%; } .mobile-prefix-90 { margin-left: 90%; } .mobile-suffix-90 { margin-right: 90%; } .mobile-push-90 { left: 90%; } .mobile-pull-90 { left: -90%; } .mobile-grid-95 { float: left; width: 95%; } .mobile-prefix-95 { margin-left: 95%; } .mobile-suffix-95 { margin-right: 95%; } .mobile-push-95 { left: 95%; } .mobile-pull-95 { left: -95%; } .mobile-grid-33 { float: left; width: 33.33333%; } .mobile-prefix-33 { margin-left: 33.33333%; } .mobile-suffix-33 { margin-right: 33.33333%; } .mobile-push-33 { left: 33.33333%; } .mobile-pull-33 { left: -33.33333%; } .mobile-grid-66 { float: left; width: 66.66667%; } .mobile-prefix-66 { margin-left: 66.66667%; } .mobile-suffix-66 { margin-right: 66.66667%; } .mobile-push-66 { left: 66.66667%; } .mobile-pull-66 { left: -66.66667%; } .mobile-grid-100 { clear: both; width: 100%; } }
and lastly instal the plugin mobile navigation and configure it then you have 2 separate navigations
[link removed]
@elaske – make sure that you are using a child theme to make any changes to your theme files – otherwise they will be lost when the theme is updated.
EDITED – oh sorry, I see the other thread isn’t yours :). But DO start by making a child theme – https://codex.www.ads-software.com/Child_Themes
BTW, I expect Greg (the theme author) will address this issue :)!
There is one minor problem with this solution: the menu from the Mobile Navigation plugin shows up under the admin menu when logged in as an admin. This is minor because it doesn’t appear to be a problem to the user, but it leads to a problem in testing it.
Should this problem be noted in this or the Mobile Navigation plugin’s issues?
- The topic ‘Non-responsive menu’ is closed to new replies.