Linking to a specific tab from a button link

  1. Create individual classes for all your tabs

  2. Put the code below into Site Settings > Custom Code > Footer Code:

     <script>
     function getParam(name) {
         name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
         var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
         results = regex.exec(location.search);
         return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
     }
     var Webflow = Webflow || [];
     Webflow.push(function () {
         var tabName = getParam('tab');
         if (tabName) $('.' + tabName).triggerHandler('click');
     });
     </script>
    
  3. Append this to the href/URL on the button you are linking from

     /pagename?tab=tabclass
    

    Replace pagename and tabclass with slug of the page that the tabs are in. eg. If the tabs are in the ‘about’ page and you want to link to the 2rd tab with a class of ‘secondtab’, then;

     /about?tab=secondtab
    

Hope this helps. This topic was discussed here;

6 Likes