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

How to Replicate D&D 5e Gear Icon Functionality

Asking this question again, but differently. ;) How do I achieve the drop-down functionality found in the repeating item sections of the D&D 5e character sheet? More specifically, where the gear icon is clicked and a hidden block of stuff is displayed for editing, pushing the rest of the list contents downward while the hidden div is open? HTML <fieldset class="repeating_armor"> <select name="attr_armor_type"> <option value="-1">select...</option> <option value="0">Clothing Only</option> <option value="1">Hide and Fur Armor</option> <option value="2">Leather Armor</option> <option value="3">Ring Mail or Scale Armor</option> <option value="4">Chain Mail Armor</option> <option value="5">Banded Plate or Lamellar Armor</option> <option value="6">Plate Armor</option> <option value="7">Shield</option> </select> <div class="repeating-name-value-span"><label>AC:</label> <span name="attr_armor_ac">0</span></div> <div class="repeating-name-value-span"><label>Bonus:</label> <input type="number" name="attr_armor_magic_bonus"/></div> <div class="repeating-name-value-span"><label>Enc:</label> <span name="attr_armor_enc">0</span></div> <button type="action" class="pictos-gear" name="act_details">y</button> <input type="hidden" class="armor-show-details" value="0" name="attr_armor_show_details"/> <div class="show-hide"><textarea name="attr_armor_details"></textarea></div> </fieldset> Sheet worker script on("clicked:repeating_armor:details", function(eventInfo) { getAttrs(["repeating_armor_armor_show_details"], function(values) { const currentValue = parseInt(values.repeating_armor_armor_show_details)||0; const newValue = (currentValue == 1) ? 0 : 1; setAttrs({repeating_armor_armor_show_details : newValue}); }); }); CSS div.sheet-show-hide { display: block; } input.sheet-armor-show-details[value="0"] ~ div.sheet-show-hide { display: none; } Everything works, except the toggled div is displayed under  subsequent repeating items - I either need it on top or have it push the remaining page elements downwards. Since the D&D 5e sheet does this, I assume I'm able to do the same, but I can't figure out how.
1588647901

Edited 1588648295
Using just your supplied code loaded into a game, clicking the act_details button opens the textarea and pushes the next repeating section item down (see screenshot below). I think there must be other CSS code that is affecting this behavior, or maybe I am not understanding what your issue is. Can you post a screenshot of what you are seeing? Can you mock up an illustration of what you want to see (if it is not like below)?
Huh - so *this* line of CSS caused the problem... .repitem { height: 2.5em; } If I remove it, it works *exactly* how I want. :D I had this style because I placed all my repeating item elements inline and then wanted more space between repeating item rows. I'd rather have the show/hide working, so I'll figure out another way to do the line spacing in the .repitem. THANKS!