Oct 22, 201811:18 AM - edited Oct 22, 201811:54 AM
Top Contributor
JS tabbed content - On load issues
SOLVE
Hi all
Just been messing around with js tabbed content, something I am pretty new to. I went to w3 to get an example (HERE) and pretty much copied and pasted it over to design manager to play with. Applying .tabcontent classes to content module groups and wrapping the button groups like so: <element onclick="openCity(event, 'London')">{{ html }}</element>
The only problem I am having is that the page loads and displays each tab's content where I want it to display none at first. The script works otherwise as intended, clicking each button will display that tab's content and hides the rest, it's just that initial issue upon loading the page I can't figure out.
Is it ok if you explain the inner workings to me little? I and maybe others will likely do this in the future so would be good to get an understanding and learn from the experience.
I am not sure where my second update post went, but I had thought of:
@Hawk-Steve - Sure! When I first looked at your page (it's not now)... I did
$('.tabcontent').length //result was 5
But, I only saw 4 tabcontents you wanted hidden, so I figured I would Isolate the 4 a little bit more by targeting the parent container and hiding only the children that contained tabcontent. That's why there was nth-child(n+4)
However, your page structure is now different from when I wrote the code and you only have 4 tabcontent blocks so, the following css should be sufficient
Oct 23, 20184:51 AM - edited Oct 23, 20184:52 AM
Top Contributor
JS tabbed content - On load issues
SOLVE
Hi Tim
I think I'd caused some confusion by accidentally making a change and altering the structure, which I quickly reverted when I noticed. It seems you had already picked up the post while it was changed.
Thanks for explaining your reasoning behind it, the child element makes sense now.
So I guess the question is, how do I prevent .row-fluid from affecting the script? I can see .row-fluid sits quite high up on the grid. I would simply do this but this stops the script from working correctly.