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

My toggles open/close both boxes

1501260043
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
I have two hideable boxes. Each has a button to display/not display their respective section. In the preview they work as expected. In game they both open/close both sections. Any ideas?
1501260816
Lithl
Pro
Sheet Author
API Scripter
You're going to have to share the code.
1501262107

Edited 1501262290
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
HTML <div class="sheet-box sheet-combat-modifiers"> <!-- =====================MELEE COMBAT MODIFIERS=========================== --> <div class="sheet-table"> <input type="checkbox" class="sheet-arrow" name="attr_modifier-toggle" checked/><span></span> <div class="sheet-header"><div class="sheet-colX">MELEE MODIFIERS</div></div> <div class="sheet-hold"> <!-- BUNCH OF CONTENT HERE --> </div> <!-- End .sheet-hold --> </div> <!-- .sheet-table --> </div> <!-- end sheet box --> <div class="sheet-box sheet-combat-modifiers"> <!-- =========================RANGED COMBAT MODIFIERS============================ --> <div class="sheet-table"> <input type="checkbox" class="sheet-arrow" name="attr_modifier-toggle" checked/><span></span> <div class="sheet-header"><div class="sheet-colX">RANGED MODIFIERS</div></div> <div class="sheet-hold"> <!-- BUNCH OF CONTENT HERE --> </div> <!-- End .sheet-hold --> </div> <!-- .sheet-table --> </div> <!-- end sheet-box combat modifiers --> CSS /* ======== Sheet-arrow to hide things========*/ input.sheet-arrow {     float: left; } input.sheet-arrow:checked ~ div.sheet-hold {     display: none; } input.sheet-arrow[type="checkbox"], .sheet-arrow {     opacity: 0;     width: 16px;     height: 16px;     position: relative;     top: 5px;     left: 6px;     margin: -10px;     cursor: pointer;     z-index: 1; } input.sheet-arrow[type="checkbox"] + span::before {     margin-right: 4px;     line-height: 14px;     text-align: center;     display: inline-block;     vertical-align: middle;          content: "▼";     width: 14px;     height: 14px;     font-size: 12px; } input.sheet-arrow[type="checkbox"]:checked + span::before {     content: "►"; }
1501345146

Edited 1501345258
Coal Powered Puppet
Pro
Sheet Author
The open/close code will open all of the sheet-hold's that is within the same div.  So, wrap an extra div around the box and the associated sheet-arrow.  Edit: And give each sheet-holds a different name.
1501373346
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
After naming the arrows with different attrs it is working great. Still the switchable areas are looking attractive so I think I'd like to try to implement that.