Finsweet CMS Load Attribute breaking script

Yeah, i’ve tried but can’t seem to figure out what should happen on second click.

Let me explain:

  1. The initial state of my tab content is closed like in the Loom.
  2. I’ve set each tab pane to position: absolute so that they are stacked.

Expected:

  1. On 1st click of any of the tabs (open), it opens the tab pane for that tab to display its content.
  2. If the same tab is clicked immediately after (close), it should close the tab pane associated with that tab and return to initial state with all tab content hidden.
  3. If after the 1st click of any tab, another tab is clicked immediately after, the tab which was initially open should be hidden and the tab that was clicked should be displayed - Notice how for the initial tab, I’ve not registered a 2nd click.
  4. Then if I click on the previous tab (now it is registering 2nd click), it should display its content instead of closing it.

I hope you understand me

Outcome so far

  1. I’ve gotten the initial state to work
  2. When I click on a tab and click a second time immediately, it works as expected.
  3. I can’t seem to get 3 & 4 in expected results to work.