I followed your advice but couldn't get this to work. The steps i took:
Created a new gallery page. uploaded images and added the text I want to show and a button above it named "Show More" which has the external url #expand-3.
In the gallery page settings in the PAGE HEADER CODE INJECTION, pasted your code.
Created a new page and added a carousel summary linked to the gallery page. Set Aspect ratio to auto.
However the "show More" button doesn't seem to work. The text is always expanded/shown when loading the page. Any idea what I'm doing wrong?