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 trialKatharine Cooney
4,612 PointsIssue with the Hide Function
When I use the hide function and preview the page, the warning appears for maybe half a second and THEN hides. I tried previewing the page on both Chrome and IE and both have the same issue. Does anyone know how to fix this? This is my code (I think it's identical to the code in the video!)
//Hide warning jQuery(".warning").hide(); //Show warning slowly jQuery(".warning").show("slow");
1 Answer
Steven Parker
231,275 PointsThis would be a good place to use CSS.
To avoid "flashing" the element you want initially hidden, you can use CSS to hide it instead of JavaScript, like this:
.warning { display: none; }
You can still use the JavaScript for the slow reveal using show.
nico dev
20,364 Pointsnico dev
20,364 PointsThank you!!
I learn so much with your answers, and I thought I had to say 'Thank you'.
And this really seemed to me the perfect answer/place to say it.
Steven Parker
231,275 PointsSteven Parker
231,275 PointsI appreciate your comments Nico Trivelli, happy to help.