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

In need of CSS Wizard help

1514915722
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
So what I am trying to do is link my loadout choice radio button to my DR boxes. There are 3 loadout choices and 3 DR Loadout boxes. I am trying to make them behave like tabs so that only the selected corresponding DR box is displayed.  Here is the HTML for the button <div class="sheet-box sheet-loadouts"> <div class="sheet-table"> <div class="sheet-header"> <div class="sheet-cell sheet-col0"><input type="radio" value="1" name="attr_loadoutchoice" checked="checked" class="sheet-loadoutchoice sheet-loadoutchoice1"/></div> The HTML for the DR Loadout Box <div class="sheet-loadoutchoice-content sheet-loadoutchoice1"> Bunch of content here </div> The CSS for to make it happen with my errors /* =======DR TABS =========== */ input.sheet-loadoutchoice .sheet-loadoutchoice1:not(:checked) ~ .sheet-loadoutchoice .sheet-loadoutchoice1, input.sheet-loadoutchoice .sheet-loadoutchoice2:not(:checked) ~ .sheet-loadoutchoice .sheet-loadoutchoice2, input.sheet-loadoutchoice .sheet-loadoutchoice3:not(:checked) ~ .sheet-loadoutchoice .sheet-loadoutchoice3 { display: none; } Any help would be appreciated
1514917795
plexsoup
Marketplace Creator
Sheet Author
API Scripter
I would do it more like this: <a href="https://jsfiddle.net/a6z9Ljry/1/" rel="nofollow">https://jsfiddle.net/a6z9Ljry/1/</a> HTML &lt;input type="radio" value="1" name="attr_loadoutchoice" checked="checked" class="sheet-loadoutchoice"/&gt; &lt;input type="radio" value="2" name="attr_loadoutchoice" class="sheet-loadoutchoice"/&gt; &lt;input type="radio" value="3" name="attr_loadoutchoice" class="sheet-loadoutchoice"&gt; &lt;div class="sheet-loadoutchoice-content sheet-loadoutchoice1"&gt; Loadout 1 &lt;/div&gt; &lt;div class="sheet-loadoutchoice-content sheet-loadoutchoice2"&gt; Loadout 2 &lt;/div&gt; &lt;div class="sheet-loadoutchoice-content sheet-loadoutchoice3"&gt; Loadout 3 &lt;/div&gt; CSS div.sheet-loadoutchoice-content { &nbsp; display:none; } /* =======DR TABS =========== */ input.sheet-loadoutchoice[name="attr_loadoutchoice"][value="1"]:checked ~ div.sheet-loadoutchoice1, input.sheet-loadoutchoice[name="attr_loadoutchoice"][value="2"]:checked ~ div.sheet-loadoutchoice2, input.sheet-loadoutchoice[name="attr_loadoutchoice"][value="3"]:checked ~ div.sheet-loadoutchoice3 { display: block; }
1514918770
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
Well that only caused the DR box to disappear.
1514920913
plexsoup
Marketplace Creator
Sheet Author
API Scripter
Did you look at the js fiddle link?
1514923550
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
Yep, still I have no success
1514924197

Edited 1514924224
plexsoup
Marketplace Creator
Sheet Author
API Scripter
Weird. Maybe I don't fully understand what you're trying to achieve. Can you share with me your whole files on pastebin or gist?
1514928083
Finderski
Plus
Sheet Author
Compendium Curator
I believe your problem is with this: &lt;div class="sheet-cell sheet-col0"&gt;&lt;input type="radio" value="1" name="attr_loadoutchoice" checked="checked" class="sheet-loadoutchoice sheet-loadoutchoice1"/&gt;&lt;/div&gt; Your radio button &nbsp;is not a sibling of the divs you want to hide/show based on that. If you follow plexsoup's code, you'll note there is nothing between the radio buttons and the divs you want to have affected by those radio buttons. &nbsp;If you need to keep the radio buttons the way you have them for aesthetics, that's fine, but you'll need a trick that works in Roll20 (and not necessarily outside of R20). The trick is creating three checkboxes with the exact same names as the radio buttons and position them directly above the divs you want to show/hide, like plexsoup shows above. The checkboxes would be something like: &lt;input type="checkbox" value="1" name="attr_loadoutchoice" checked="checked" class="sheet-loadoutchoice"/&gt; &lt;input type="checkbox" value="2" name="attr_loadoutchoice" class="sheet-loadoutchoice"/&gt; &lt;input type="checkbox" value="3" name="attr_loadoutchoice" class="sheet-loadoutchoice"&gt; You'll want to be sure that whichever value in the radio buttons is checked by default, that the corresponding checkbox is also checked by default.
1514929516
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
HTML CSS
1514929562
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
@ Finderski I have it working just not the way i want it to.
1514930208
Finderski
Plus
Sheet Author
Compendium Curator
Scott S. said: HTML CSS Both links go to the CSS code...
1514938391
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
Ah Crap! HTML
1514940217

Edited 1514940327
plexsoup
Marketplace Creator
Sheet Author
API Scripter
Ok. Got the sheet: Can you tell us how you'd like them to work?
1514944650
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
OK, so here are the Loadout selections. They each have a radio button.&nbsp; I want the hit location to change&nbsp; When the player changes loadouts.
1514945822

Edited 1514945842
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
Eventually I will be setting up the inventory to allow the defense equipment to accept inputs for DR that would be reflected in the Hit Locations.&nbsp; Just need to learn how.
1514948387

Edited 1514948648
plexsoup
Marketplace Creator
Sheet Author
API Scripter
I think you're almost there. Make sure the loadout radio buttons (on the wealth page) have the same name as the new radio buttons we made (on the combat page). ie: They both have to be either attr_DRloadoutchoice, or attr_loadoutchoice. They can't be different. Next, you might get some weirdness if you have two sets of radio buttons with the same name, so change your new radio buttons to checkboxes, then make them hidden. Let me know if you need more help than that. (Also, like Finderski said, sometimes it's useful to keep your hidden checkboxes at the top of the hierarchy. But if you move them now, you'll want to read up on&nbsp; CSS Selectors ; the tilde ~ may be the wrong selector for that.)
1514949343
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
Yes that was the issue I was running into. This is the working model. I had the button names same in the first place but nothing was working. I just really need some help getting this right. I need to know what right looks like so to speak.
1514959603

Edited 1514959795
plexsoup
Marketplace Creator
Sheet Author
API Scripter
Try changing your files like this: HTML lines 1979-1981 &lt;input type="checkbox" value="1" name="attr_loadoutchoice" checked="checked" class="sheet-hidden sheet-loadoutchoice"/&gt; &lt;input type="checkbox" value="2" name="attr_loadoutchoice" class="sheet-hidden sheet-loadoutchoice"/&gt; &lt;input type="checkbox" value="3" name="attr_loadoutchoice" class="sheet-hidden sheet-loadoutchoice"&gt; CSS lines 155-158 input.sheet-loadoutchoice[type="checkbox"][name="attr_loadoutchoice"][value="1"]:checked ~ div.sheet-loadoutchoice1, input.sheet-loadoutchoice[type="checkbox"][name="attr_loadoutchoice"][value="2"]:checked ~ div.sheet-loadoutchoice2, input.sheet-loadoutchoice[type="checkbox"][name="attr_loadoutchoice"][value="3"]:checked ~ div.sheet-loadoutchoice3 { display: block; } Here's a test game with the character sheet <a href="https://app.roll20.net/join/2888014/RX_6oQ" rel="nofollow">https://app.roll20.net/join/2888014/RX_6oQ</a>
1514981832
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
Amazing, that is exactly what I was trying to accomplish.
1514987342
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
Thank you sooooo much!!!