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

"Selected" Button Tab Formatting

I have created a set of navigational buttons that switch between sections of the character sheet at the header of my character sheet.  The problem is that I cannot seem to figure out how to change the formatting of them depending on which tab is "selected"  Back when I was using spans and input checkboxes to handle the navigation buttons this was fairly straight forward ( well as straightforward as that monstrosity of a code snippet used to be..)  But when I switched to sheet workers I can no longer use the states of an input button to alter the style of the input sections (cause I just use buttons now). I was wondering if someone could show me an example code of what I need to do in order to alter the formatting.  I'm looking for a change in color for hover and for to indicate the active section of the character sheet. My navigation code is as follows, including both the HTML and the SheetWorkers scripts.. <input type="hidden" class="sheet-tabstoggle" name="attr_sheetTab"  value="character"  /> <div>     <button type="action" name="act_core" >Core </button>     <button type="action" name="act_gear" >Gear </button>     <button type="action" name="act_advancements" >Advancements </button> <button type="action" name="act_npc" >NPCS </button>     <button type="action" name="act_journal" >Journal </button>     <button type="action" name="act_vehicles" >Vehicles </button> <button type="action" name="act_psykana" >Psykana </button>     <button type="action" name="act_social" >Social </button>     <button type="action" name="act_ship" >Ship </button> <button type="action" name="act_config" >CONFIG </button>     <button type="action" name="act_debug" >DEBUG </button> </div> <script>     const buttonlist = ["core","gear","advancements", "npc", "journal", "vehicles", "psykana", "social", "ship", "config", "debug"];     buttonlist.forEach(button => {         on(`clicked:${button}`, function() {             setAttrs({                 sheetTab: button             });         });     }); </script> Now, I am assuming that I need to do something with the sheet workers to indicate the active tab, probably in the form of a hidden field on the character sheet.  But, I am not entirely sure if this is correct.  Their may be a better way to do this; not really sure.  Also, I am also using similar code for character sheet subsections, so I am hoping for code that wont need to have all kinda of crazy hierarchy, that is to say I'm hoping for code that would be something like: .sheet-navbutton:hover rather than being prefaced by every single parent item on the page, which makes it incredibly hard to duplicate elsewhere on the character sheet, especially inside of repeating sections.  If that makes sense. Once again, thanks for the assistance.
1667546011
.Hell
Sheet Author
<a href="https://github.com/Roll20/roll20-character-sheets/blob/master/TheWitcher/witchersheet.css#L524" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/blob/master/TheWitcher/witchersheet.css#L524</a> <a href="https://github.com/Roll20/roll20-character-sheets/blob/master/TheWitcher/witchersheet.html#L285" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/blob/master/TheWitcher/witchersheet.html#L285</a> I linked you how I did it. You had the right idea
.Hell said: <a href="https://github.com/Roll20/roll20-character-sheets/blob/master/TheWitcher/witchersheet.css#L524" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/blob/master/TheWitcher/witchersheet.css#L524</a> <a href="https://github.com/Roll20/roll20-character-sheets/blob/master/TheWitcher/witchersheet.html#L285" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/blob/master/TheWitcher/witchersheet.html#L285</a> I linked you how I did it. You had the right idea So, I finally managed to get it working and for some reason my code would simply not function as you had it coded, I had to re-write all of your css to include "sheet-" prepend to all of the styles in the css.&nbsp; I'm not sure why your css works and doesn't need it, but w/e.&nbsp; It is working and that is what matters.&nbsp; Should make things alot better looking than just having no indication that a section is... activated. Thank you again.
1667637526
.Hell
Sheet Author
Do you have legacy: true in your sheet.json? Some years ago roll20 changed the handling of css classes and some old sheets do not adhere to it yet
1667668073

Edited 1667668411
Toby
Pro
Yeah, I have legacy true, my character sheet doesnt work without it, and I haven't been able to find any guides on how to convert it forward without literally breaking everything on my character sheet and rewriting everything from scratch.&nbsp; It is something I actually have wanted to learn to do, because I want to use variable in my css, to create light and dark mode versions of my sheet.&nbsp; Not to mention, I have vision issues and I need my sheets to have big text and some of my players have said everything is too big.&nbsp; So font adjust would be nice too. But, I dont really have a lot of time to re-learn all of my css, so it has been somewhat low on my priority.&nbsp; Anyways, thank you very much for helping with the highlighting issue with my buttons.&nbsp; Now I need to see if I can port it INTO repeating sections.&nbsp; I hate bringing stuff into repeating sections.. its always such a pain to deal with them.