Streaming live at 10am (PST)

Button set focus tab


#1

Ok, let's say I have 2 buttons on my page named "faq" and "review". I would like them, when clicked, to set focus on a tab and move to the section in the page. I've tried this here but it didn't work for me: http://forum.webflow.com/t/select-a-tab-using-another-button-or-link/3665

Maybe I'm missing something? Help is appreciated. Thanks!


#2

I figured it out. Maybe not the best way but it seems easy to me.

My two buttons are product review and faq.

I added this code to the <head> tag:

<script>
function product()
{
document.getElementById('product-reviews-tab').click();
}

function faq()
{
document.getElementById('questions-tab').click();
}
</script>

Then for each of my tabs I created IDs under Settings for each. I named them product-reviews-tab and questions-tab.

I then linked each button to each the IDs section. This makes the button when clicked scroll the page to the tab. It doesn't seem to add the click though.

So I added to each button a custom attribute. I set Name to onclick and Value to product() for the product review button. And I set Name to onclick and Value to faq() for the faq button.

I had to export my full site and test it on my web host to see it work. Hope this helps someone. If you know an easier way please do share.


#3

Thanks It works for me cheers!!!!!


#4