I have 4 buttons on the site (default blue color) and I’m trying to assign or link each button to a different tab in the tabs menu (our partner’s section) below. I’ve attempted to use this example in the forums: Linking to Specific Tab from another Link or Button but it seems that this example works with linking a different tab in another page. My Achilles heel is JQuery and I’m having a difficult time trying to solve this. I really would appreciate it if someone could please help me figure this out…Thank you
Thank you samliew for the quick reply! There are four buttons, one in each section: kitchen, bath, lifestyle, and outdoor. Each button will need to link to the tabs in the tabs menu below (partner’s section) the four tabs are marked: kitchen, bath, lifestyle and outdoor.
The custom code that I’ve found is:
<script>
var Webflow = Webflow || [];
Webflow.push(function () {
var tabName = getParam('tab');
if (!tabName) return;
$('.' + tabName).triggerHandler('click');
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, " "));
}
});
</script>
and I placed the custom code within the tag.
I certanly appreciate your assitance on this, I’m a little lost when it comes to JQuery.
I’ve literally copy pasted your code (removed the 4th class as I only have 3 buttons) and copied the same tab IDs and button IDs. But nothing happens when I publish the site!
Under one of my tabs i have some dynamic paginated content but when you hit next to bring up the next results the tab defaults to the first tab. So i tried in implement this solution but obviously the pagination throws complexity into the mix and it kills the next button thus killing pagination.
Have you been able to target a tab with pagination next and previous buttons using something like this?
The code works on the website I’m working on (thanks a ton!) but I was wondering why it doesn’t work if you put it in an “Embed” element? I did move the element above the tabs if it’s important.
Any idea why this sort of thing would only work intermittently? I’m guessing that all scripts need to finish loading before this specific one can run and do its thing.