Child pages, menu button

www.bigsmitty.com

client wants child pages (example: pages under band members page) to be hidden when the navigator is viewed from the menu button until a user clicks on the parent page. as it stands, this specific parent page is empty (points to #).

Hello there,

I am sorry, I can’t clearly get your objective. Do you want to hide it on mobile menu? Please advice.

Regards,
Kharis

when accessing the site’s navigation from the menu button, such as on mobile, all pages are displayed including pages that are child pages.

i want to only see the top-level pages until a parent page is clicked on to reveal child pages.

on the aforelinked site, when using the menu button, i would like the seven child pages under the parent page “band members” to be hidden until the parent page is clicked on.

still not making sense?

Hello there,

I would like to apologize in advance for the delay. It was make sense. To accomplish it, it requires jQuery code addition and evolve testing and debugging. Please try to follow these steps:

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided box

;(function($) {

   'use strict'

   if ( matchMedia( 'only screen and (max-width: 991px)' ).matches ) {
   
     $('.main-navigation').children().find('.sub-menu').wrap('<div class="sub-menu-wrapper" style="display: none;" />');

     $('.menu-item-has-children').children('a').click(function(){

        $(this).next('.sub-menu-wrapper').slideToggle();

        return false;
     
     }); 

   }      

})(jQuery);   

  1. Update

Let me know how it goes.

Regards,
Kharis

plugin installed and activated, code added. however there is no change in behavior yet.

Hello there,

Please replace the code I suggested with this one:


;(function($) {

   'use strict'

   if ( matchMedia( 'only screen and (max-width: 991px)' ).matches ) {
   
     $('.main-navigation').children().find('.children').wrap('<div class="sub-menu-wrapper" style="display: none;" />');

     $('.page_item_has_children').children('a').click(function(){

        $(this).next('.sub-menu-wrapper').slideToggle();

        return false;
     
     }); 

   }      

})(jQuery); 

Regards,
Kharis

jackpot!

much thx!

You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis