I'm trying to figure out how I can minimize part of a weapon block that I made using a repeating section. I want to be able to minimize the first weapon in the repeating section without minimizing the second and vice versa. HTML is below. <fieldset class="repeating_weapon">
<!--min/max buttons-->
<button type="action" class="sheet-minToggleWeapon" name="act_minweaponbtn">Minimize</button>
<button type="action" class="sheet-maxToggleWeapon" name="act_maxweaponbtn">Maximize</button>
<input type="hidden" class="sheet-maxMinWeaponHidden" name="attr_maxminweapon" value="maxweaponbtn">
<!--weapon name-->
<div class="sheet-weaponNameDiv">
<input type="text" class="sheet-weaponNameInput" name="attr_weaponName" placeholder="Weapon Name">
</div>
<!--full block-->
<div class="sheet-fullBlockWeapon">
<!--range-->
<div class="sheet-weaponRangeDiv">
<h3 class="sheet-weaponRangeTitle">Range</h3>
<input type="number" class="sheet-weaponRangeInput" name="attr_range">
</div>
</div>
</fieldset> The div under <!--full block--> is what I'm looking to have minimized while the rest is on at all times. The buttons and input at the top under <!--min/max buttons--> is to tie them to the javascript and css as shown below. I've used this method for things not in a repeating section and it worked, but I'm not sure how to get it to work within a repeating section. Javascript const maxMinWeaponList = ["maxweaponbtn","minweaponbtn"];
maxMinWeaponList.forEach(button => {
on(`clicked:${button}`, function() {
setAttrs({
maxminweapon: button
});
});
}); CSS /* min/max toggle */
.sheet-maxMinWeaponHidden[value="maxweaponbtn"] ~ div.sheet-fullBlockWeapon{
display: block;
}
.sheet-maxMinWeaponHidden[value="minweaponbtn"] ~ div.sheet-fullBlockWeapon{
display: none;
} I should also mention I'm not fluent in coding at all and javascript is especially hard for me to wrap my head around. The method I have above is just something I found online.