Open Specific Tabs from other Pages
Function
</ 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.
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
Contributor
CodeCrumbs Team
Short Description:
Link to and open a specific tab from any other page on your website with Webflow's native tabs element.
Extra Info:
No extra info.
Clone Project
Documentation
Author:
N/A
Status:
Deprecated
New
Updated
This crumb is no longer being supported.
Latest Version:
Tags:
More related crumbs..
Want to contribute to the community?
Tell us what code you're working with. We would love to see it and possibly add it to the library.