Open Specific Tabs from other Pages

</ head>

</ body>

<!-- OPEN SPECIFIC TABS -->
<script>
  // get the webflow array or define a new one if none exists
  var Webflow = Webflow || [];
  // push the click tabs handler function into the webflow array
  Webflow.push(function () {
    // get the respective tab name using the getParam function and store it in a tabName variable
    var tabName = getParam('tab');
    // terminate the function if no tab name was found
    if (!tabName) return;

    // click on the tab
    $('.' + tabName).triggerHandler('click');

    // define the getParam function
    function getParam(name) {
      // replace any '[' in the tab name with '\['
      // & also replace any ']' in the tab name with '\]'
      // this escapes the symbols '[' & ']' so they can be used in regex
      name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
      // define a regex to search for the tab name
      var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        // search for the tab name in the query string part of the page's url
        results = regex.exec(location.search);
      // return the tab name OR "" if no tab name found
      return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
    }
  });
</script>

HTML/Embed

// this is the url format for each button link that when clicked navigates to the tabs page
/page-name?tab=tab-name-here
Only tabs with a " " have code.
<!-- OPEN SPECIFIC TABS -->
<script>
  // get the webflow array or define a new one if none exists
  var Webflow = Webflow || [];
  // push the click tabs handler function into the webflow array
  Webflow.push(function () {
    // get the respective tab name using the getParam function and store it in a tabName variable
    var tabName = getParam('tab');
    // terminate the function if no tab name was found
    if (!tabName) return;

    // click on the tab
    $('.' + tabName).triggerHandler('click');

    // define the getParam function
    function getParam(name) {
      // replace any '[' in the tab name with '\['
      // & also replace any ']' in the tab name with '\]'
      // this escapes the symbols '[' & ']' so they can be used in regex
      name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
      // define a regex to search for the tab name
      var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        // search for the tab name in the query string part of the page's url
        results = regex.exec(location.search);
      // return the tab name OR "" if no tab name found
      return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
    }
  });
</script>
Only tabs with a " " have code.
// this is the url format for each button link that when clicked navigates to the tabs page
/page-name?tab=tab-name-here
Only tabs with a " " have code.
Only tabs with a " " have code.
If you have already pasted this code into your project then you can skip this. If you haven't, and it's your first time using CodeCrumbs, then copy this code and navigate to your sites global settings > Custom Code tab > paste it into the <head> (first custom code block). It just needs to exist once.
Author
N/A
Updated on
May 8, 2024

How to use:

Unlock more with PRO

Want to learn how to use this Crumb? Unlock detailed documentation, video tutorials, comments & support!

Upgrade to Pro

Unlock more with PRO

Want to learn how to use this Crumb? Unlock detailed documentation, video tutorials, comments & support!

Upgrade to Pro
Tutorial Coming Soon!

Check Browser Support

Interactive Table

Link to and open a specific tab from any other page on your website with Webflow's native tabs element.

Clone Project
Documentation
Author:
Status:
Deprecated
New
Updated
Latest Version:
Built by
Built with
For the best experience

Please switch to desktop to view the content.

Back Home
Thank you! Your submission has been received!
Close Form
Oops! Something went wrong while submitting the form.
Become a Contributor