Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #115628

    Delphine A
    Participant

    Here is my site url: delphineatoi2voir.fr/maquette

    #115682

    Zeshan
    Member

    Hi Delphine,

    Thank you for writing in!

    Please add following code under Custom > JavaScript in the Customizer:

    jQuery(document).ready(function($) {
       function submenuCollapse() {
          windowsize = $(window).width();
          if(windowsize < 980) {
             var megaMenuLink = $('.x-navbar .x-nav > li > a.sf-with-ul'),
                 megaMenu = $('.x-nav .sub-menu>li>.sub-menu' );
    
             megaMenuLink.click(function(e) {
               e.preventDefault();
               $(this).siblings(megaMenu).toggleClass('visible');
             });
          }
       }
       submenuCollapse();
       $(window).resize(submenuCollapse);
    });
    

    and following under Custom > CSS in the Customizer:

    @media (max-width: 979px) {
       .x-navbar .x-nav > li > ul.sub-menu {
          display: none !important;
          visibility: hidden !important;
       }
       .x-navbar .x-nav > li > ul.sub-menu.visible {
          display: block !important;
          visibility: visible !important;
       }
    }
    

    Hope this helps. 馃檪

    Thank you.

    #116063

    Michael F
    Participant
    This reply has been marked as private.
    #116215

    Michael F
    Participant

    Hi,

    I have just applied the code directly above into the theme and it works to an extent.

    The Main Menu is displayed when the mobile menu button is touched. When the main menu link is touched it displays the submenus and all contents of all the submenues.

    I’m trying to get the main menu link to display the submenus, then when a submenu is clicked it displays the links of that particular submenu.

    Thanks for all the advice so far,

    Michael

    #116222

    Zeshan
    Member

    Hi Micheal,

    Thank you for writing in!

    Instead of adding above codes, please try adding the following under Custom > JavaScript in the Customizer:

    jQuery(document).ready(function($) {
       function submenuCollapse() {
          windowsize = $(window).width();
          if(windowsize < 980) {
             var subMenuLink = $('.x-navbar a.sf-with-ul'),
                 subMenu = $('ul.sub-menu' );
    
             subMenuLink.click(function(e) {
               e.preventDefault();
               $(this).siblings(subMenu).toggleClass('visible');
             });
          }
       }
       submenuCollapse();
       $(window).resize(submenuCollapse);
    });
    

    And following under Custom > CSS in the Customizer:

    @media (max-width: 979px) {
       .x-navbar .x-nav ul.sub-menu {
          display: none !important;
          visibility: hidden !important;
       }
       .x-navbar .x-nav ul.sub-menu.visible {
          display: block !important;
          visibility: visible !important;
       }
    }
    

    Hope this helps. 馃檪

    Thank you.

    #116711

    Michael F
    Participant

    Hi,

    You are brilliant!

    Thank you so much for all your help,

    Michael

    #116720

    Cousett
    Member

    Glad we were able to help. 馃檪 Have a nice day.

    #117871

    Michael F
    Participant

    Hi,

    Sorry to be the bearer of not so good news. The mobile sub-menu is not consistently working.

    The client has just emailed me with the following message and I have confirmed it as being correct on my Samsung S3. I must admit thought I has to persist in testing the menu out for a while before it happened. I asked him to detail the occasions when the mobile sub-menu was not working.

    ……………………………….

    We are only using Android smartphones.

    The strange thing is that it is not consistent, sometimes it works and sometimes it doesn鈥檛.

    Some of the glitches are:

    路 Sometimes Architecture is open, Performance Design won鈥檛 open

    路 Sometimes a project won鈥檛 open

    路 Sometimes no projects will open

    路 Sometimes can鈥檛 close the main category like Performance Design

    路 Sometimes we open Architecture and Performance Design; and then it stalls and no Submenu opens

    路 Sometimes a submenu won鈥檛 close

    路 Sometimes it works perfectly for a while, then kind of freezes or has only partial usability

    Ultimately it eventually always gets stuck.

    …………………………………………………………………………….

    Are you able to find any reason why this would happen?

    Thanks for being so helpful,

    Michael

    #118035

    Zeshan
    Member

    Hi Micheal,

    Thank you for writing in!

    You can try using this code instead under Custom > JavaScript in the Customizer:

    jQuery(document).ready(function($) {
       windowsize = $(window).width();
       if(windowsize < 980) {
          var subMenuLink = $('.x-navbar a.sf-with-ul'),
              subMenu = $('ul.sub-menu' );
    
          subMenuLink.click(function(e) {
            e.preventDefault();
            $(this).siblings(subMenu).toggleClass('visible');
          });
       }
    });
    

    Further customizations from here would be getting into custom development, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer, or look into service like Elto or WerkPress. X is quite extensible with child themes, so there are plenty of possibilities.

    Thanks for understanding.

    #128940

    Michael F
    Participant

    Hi,

    Sorry for getting back to you so late.

    I just want to thank you again for all your fantastic help.

    Your latest custom JavaScript has worked a treat! Everything is working really well thanks to your expert knowledge and help.

    Much appreciated,

    Michael

    #129173

    Cousett
    Member

    Glad we were able to help. 馃檪 Have a nice day.

    #142332

    Iain M
    Participant

    Hi Support,

    you referred me to this post, can you advise – does the last javascript code suggested on Oct 3 still require the css code added too…?

    or does it work on it’s own…

    thanks,

    Iain

    #142565

    Zeshan
    Member

    Hi Lian,

    Yes, you need to add the CSS code provided in post number #116222

    Cheers!

    #142684

    Iain M
    Participant
    This reply has been marked as private.
    #143153

    Paul R
    Moderator

    Hi Lain,

    Regretfully, at this time I am not entirely certain what it is you would like to accomplish based on the information given in your post. If you wouldn’t mind providing us with a little more clarification on what it is you’re wanting to do (a link to a similar example site would be very helpful, or perhaps some screenshots), we’ll be happy to provide you with a response once we have a better understanding of the situation.