• This problem was resolved on the forum. This write up is just to clarify the steps required to get the Menu to display correctly and not open all of the sub menus on mobile devices using a Twenty Twelve Child theme.

    First of all create and use a child theme. This will prevent future theme updates from over writing the modifications to the theme.

    Here is topic on how to create a Child Theme.

    Open the style.css of the child theme with an editor such as Notepad++ and paste in the code below provided by Dev1.addweb
    (@snehalb890)

    .main-navigation ul.nav-menu.toggled-on {
      width: 100%;
      text-align: left;
    }
    .menu-item-has-children a {
      display: block !important;
    }
    
    @media (max-width: 767px) {
      .menu-item-has-children {
        position: relative;
      }
      .main-navigation li ul {
        display: none;
      }
      .menu-item-has-children a {
        display: block !important;
      }
      .menu-item-has-children:after {
        content: ' \02C7';
        position: absolute;
        right: 70px;
        font-size: 20px;
        top: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 30px;
        width: 30px;
        cursor: pointer;
      } 
    }

    Next, if you don’t have one, create a folder in your child theme called js.

    Use the Notepad++ editor to create a file called navigation.js in this folder and paste the following code again provided by Dev1.addweb
    (@snehalb890)

    jQuery(document).ready(function($){
      if ($(window).width() > 767) {
      }
      else {
        $('.main-navigation li ul').hide();
        $('.menu-item-has-children').has('ul').click(function() {
          $('.menu-item-has-children a').css("display", "block !important");        
          $(this).children().toggle();
        });
      }

    Thanks also go to (@Chi Is Current) and (@jacobbarnett)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Zephyrinus Rodrigues

    (@zephyrr)

    Styling the Menu button with some CSS.
    I only couldn’t get the margin to work to displace the button down a little bit. I will have a play later but if anyone knows why margin-top does not work please let me know. Thank you. site: bright-work.co.uk

    button.menu-toggle{	
    	font-size: 16px;
    	font-weight: bold;
    	border-width: 5px;
        border-style: solid;
    	border-color: MediumVioletRed;
    	padding-left: 20px;
    	padding-right: 20px; 
    	padding-top: 2px;
    	padding-bottom: 2px:
    	/*margin-top: 40px;*/
    					}

    Hi!

    When trying your solution I’ve got the message “Unexpected end of Input” for the part in navigation.js

    Adding this and adding the oder code in style.css doesn’t change anything..

    Any idea?

    Thanks
    Manfred

    Okay, now sub-menus are not visible any more but now I’ve ^ and the Menus-Name. But it’s not possible to unfold the menus. And the button “Menu” ist there in the area with no funktion on my iPhone…

    Thanks
    Manfred

    Thread Starter Zephyrinus Rodrigues

    (@zephyrr)

    Hi Manfred,
    Besides the CSS code for styling the button, the rest of the code is well tested and works. From what you describe it would seem the javascript is not working. Check that you have implemented the code correctly.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fix to the SUB-MENU problem on MOBILE DEVICES: Revisted’ is closed to new replies.