JS "Shelf"

So I’m using this shelfing system… and it’s workin how it should and but I was wondering if anyone would be so kind to help me figure out how to make it so
(a) it’s initial state is set to a specified height (which I can sorta do)
(b) when it expands it expands to the full-height
© when it collapses it collapses back down to the initial height


Would be great if anyone can help out.