Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

vy le oai
vy le oai
4,697 Points

This function can only be run one time, please help me

Live demo: http://leoaivy.github.io/projects/innerbus/task2.html

When clicking the white box, the parent box will increase its size then the text gradually apprears. But after clicking the close button and clicking the white box again, the parent box still increases its size while the text doesn't appear. Just don't know why. Please help me, thank you very much for your help!

Can you verify that the codepen looks like a white background with an orange polygon? I'm not sure if I see the white box you're referring to...

What Tim said! +1

1 Answer

Tim Knight
Tim Knight
28,888 Points

You might consider assigning your setTimeout to a variable so when you close the box you can execute window.clearTimeout(timeoutVariable) to clear your timer and get you back to your foundational state.