Buy me a coffee

(Menu Block) Change default section

Suppose you have a Menu Block with 3 tabs: MEALS, DRINKS, DINNER.

By default, MEALS will open first when users access the page. But in this post, I will share some steps to change this to tab DINNER.

Menu Block Change Default Section 01 Min

#1. You need to know this

Menu Block Change Default Section 02 Min

#2. Use this code to Individual Page Header Code Injection (the page where you use Menu Block)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
  jQuery(document).ready(function($){
    setTimeout(function(){
              $('label[role="tab"]:nth-child(3)').click();
              $('label[role="tab"]:nth-child(3)').addClass('menu-select-labels--active');
    $('label[role="tab"]:nth-child(1)').removeClass('menu-select-labels--active');
         }, 2000);

})
</script>

Menu Block Change Default Section 04.jpg Min

#3. Note: You will see number 2000 in the code. It means that after the page has finished loading, 2 seconds later the code will start running.

Result:

Menu Block Change Default Section 03 Min