Streaming live at 10am (PST)

Buttons on homepage link to specific tab on services page

#1

Hello,

I am trying to use custom code so that the “learn more” buttons under the services section on my homepage links to the specific tabs on the services page.

I have read thru some forum posts and have been guided to add this custom code:

My question is: what are the next steps to link the homepage buttons to the specific services tabs on the services page? I have also added a combo class to each tab link.

Here is my site link:
https://preview.webflow.com/preview/safety-officer?utm_source=safety-officer&preview=37a89c940e8c0279501954e23b9f1702

I’d really appreciate the help!

Thanks,
Bec

Here is my site Read-Only: LINK
([how to share your site Read-Only link][2])

[2]: https://university. .com/article/sharing-your-sites-read-only-link

1 Like
#2

For whatever reason the custom code did not post here…

But you can find the code in the header of the customer code on the site.

1 Like
#3

Hello :raised_hands:

You can use @AlexManyeki Method > Linking to a specific tab from a button link

Try and reach out if you have problems

Piter :webflow_heart:

#4

Hi @PiterDimitrov

I have done exactly what @AlexManyeki has told me to do and it still not working :frowning:

Could you please check my code/classes/URL to make sure I did everything properly?

Link to my site above

I have a combo class to my buttons. Is that what’s blocking this?

Please help!

Thanks,
Bec

1 Like
#5

@rlowe1228

Hey Rebcca. Looks like a moderator edited the code and made a mistake in the process. Here is the corrected version.

<script>
     function getParam(name) {
         name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
         var regex = new RegExp("[\\?&]" + name + "=([^&#]*)");
         var 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>
1 Like
#6

@rlowe1228

You could also create an external link with /slugname#idtotarget

#7

Hello @rlowe1228

Is everything okey now?

Piter :webflow_heart: