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

CSS jQuery Basics (2014) Creating a Simple Lightbox Perform: Part 2

Chen Sun
Chen Sun
3,247 Points

why the screen turns black in the beginning?

And why after set display to none when clicking the image the overlay effect shows again?

Hey, I will take the risk of answering as studend and not english speaker.

It turns black because is appended to the body from the beginning, so it's always there. When you put it on "display: none;" on your CSS it dissapear, then with the "show() method", this style changes to visible because it overwrite the previous style of "display: none"

Something similar happen when you use "hide()" and then "show()"

Cheers!