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 trialJana Ryndin
7,161 PointsWhy the screen does not turn black?
jQuery
var $overlay = $('<div id="overlay"></div'>);
$("body").append($overlay);
$("#imageGallery a").click(function(event){
event.preventDefault();
var href = $(this).attr("href");
$overlay.show();
CSS
#overlay {
background:black;
width:100%;
height:100%;
position:absolute;
top:0;
left:0;
}
4 Answers
Kevin Korte
28,149 PointsIn addition to Sean Do's suggestion, you also did not close your click function at the end of the JS file. })
You're missing that.
Make those two correction, and you can verify your code works.
Sean Do
11,933 Pointsvar $overlay = $('<div id="overlay"></div'>);
The single quote is inside the div end tag.
Jana Ryndin
7,161 PointsThank you so much. After I posted I found it too. Wanted to let people know here but you were quicker. This was it, it works!
Jana Ryndin
7,161 PointsI closed the click function but forgot to include it here in the post. Thanks.