Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Problem with tabs in my character sheet, need help!

1606313291
Onirim
Sheet Author
Hi people, I make a sheet for my coming RPG Energy City, and my tabs doesn't work! I've used this code on HTML:     <button type="action" name="act_character" style="margin-top: 2px;" >Personnage</button>     <button type="action" name="act_organization" >Organisation</button> <input type="hidden" class="sheet-tabstoggle" name="attr_sheetTab"  value="character"  /> <script type="text/worker"> const buttonlist = ["character","organization"]; buttonlist.forEach(button => { on(`clicked:${button}`, function() { setAttrs({ sheetTab: button }); }); }); </script> And on the CSS file: /*Configure the tab buttons*/ .sheet-charactertab, .sheet-organizationtab { display: none; } /* show the selected tab */ .sheet-tabstoggle[value="character"] ~ div.sheet-charactertab, .sheet-tabstoggle[value="organization"] ~ div.sheet-organizationtab { display: block; } And I've use a <div class="sheet-charactertab"> for my sheet and all is hidden! Don't understand why. If you can help me, the source files are here: Onirim/Roll20-EnergySystem (github.com) Thanks! :)
1606316242
Andreas J.
Forum Champion
Sheet Author
Translator
The way the CSS is constructed is that the tabstoggle input need to exist before the actual sheet sections for things to work. You need to move the < input type =" hidden " class =" sheet-tabstoggle " name =" attr_sheetTab " value =" character " /> to the start of the sheet. What this CSS does .sheet-tabstoggle[value="character"] ~ div.sheet-charactertab{ display: block; } This code says, "If there is a HTML element with the  tabstoggle CSS class that has the value "character" , and at some point after it there is a div element with the charactertab CSS class, display that div element as a block . MDN gives more info on the General sibling selector " ~" I recommend you look up some tutorials/guides on the very basics of CSS & HTML, as understanding the core building blocks will make it easier to understand what's going on, and to make your own changes to things.
1606316942
Onirim
Sheet Author
Damn, yeah! Thank you for the explanation, that's help me so much. I'm not a web developer, but I think I will learn a little more ^^