Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.