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 jQuery Basics (2014) Creating a Simple Lightbox Perform: Part 2

What's wrong with my code?

I did not get the intended result after adding display: none and background: rgba( 0 0 0 0.7 ) which is done in the final portion of the video. I was able to follow along until then. my workspace snapshot is: https://w.trhou.se/ovl5jps7qk

3 Answers

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

I think your problem is in your css because you should add a comma between your 0's in background rgba (I might be wrong):

background: rgba(0 0 0 0.7); // How it is in your css now

background: rgba(0, 0, 0, 0.7); // Try this instead
Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Good catch! Ok, I'm getting old and can't see commas anymore LOL. But yes, they should have commas. Here's the documentation from w3c https://www.w3.org/wiki/CSS/Properties/color/RGBA

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

Yea I didn't see it at first too because I focused on the jQuery and html (I might need new glasses, hehe), but I hope this will solve the problem :-)

The comas did it. Thanks a lot.

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

the style background: rgba(0, 0, 0, 0.7) is assigned to an id with the name overlay (#overlay) and you don't have the id anywhere in your html - you need to add the id to something in your html file :-)

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Actually, the first two lines of his javascript file appends the div with the overlay ID to the body of the document. The only error I've seen so far (or discrepency) is that you've created a variable named "hre" where he uses a variable named "href". I can't find yet though where you access that variable.

Here's the id "overlay" code he uses:

var $overlay = $('<div id="overlay"></div>');
$("body").append($overlay);

And here's the discrepancy I've found between the video and the code:

var hre = $(this).attr("href");  // Andrew names this variable href

But again, I can't find the reference to that variable in your code. I'm still looking though! :)