Streaming live at 10am (PST)

JS Button Active with Tabs


#1

Hey guys,

I am trying to get my button to remain active when the user switches between tabs (created natively in Webflow).

I have used the following for when the page loads but if I start in a different tab and then toggle over, the button background color doesn't stay on focus.

<script> document.getElementById('focusmeplease').focus();
</script>

Any ideas?

Thanks,


#2

That's because when the user clicks, everything else is "un-focused". What are you trying to accomplish with this?


#3

My entire site is only one page and I have a tab bar navigation in my header.

The button is on the third tab so the user has to click the third tab before the button and JS for it is displayed.

My question is, how to I keep the button focused and active the entire time the user is on the page no matter what tab they switch to/ start on?


#4

I'm asking why you need this button focused?


#5

I have an isotope filter on some CMS content. When my initial page is not the tab where the isotope list is on the button loses its focus when I selected the tab:

However if I make that tab the initial tab everything works fine and the list displays nicely.


#6

There are two simple ways,

  1. Only use the plugin on the initial tab

  2. Do not use tabs for navigation


#7