How do i invert this toggle function in gsap/js?

Viewed 15

I got this little toggle function that uses gsap and js. I want the content divs to be closed when the page loads, so that they on the first click expands, and on next click collapes.

Got the code here: https://codepen.io/GreenSock/pen/BaMyWb

I have tried to set the style attribute in html like below, but then it just closes anyway. How would you do it?

<div class="expander">
    <div class="header">Click Me</div>
        <div class="content" style="height: 0px;">
            content here
        </div>
    </div>
</div>
0 Answers
Related