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 trialSandesh pathak
Full Stack JavaScript Techdegree Student 8,073 PointsWhat'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
Python Web Development Techdegree Student 38,322 PointsI 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
Henrik Christensen
Python Web Development Techdegree Student 38,322 Pointsthe 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
Treehouse TeacherActually, 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! :)
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsAh I see, I just looked in the html and css :-P
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherGood 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
Python Web Development Techdegree Student 38,322 PointsHenrik Christensen
Python Web Development Techdegree Student 38,322 PointsYea 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 :-)
Sandesh pathak
Full Stack JavaScript Techdegree Student 8,073 PointsSandesh pathak
Full Stack JavaScript Techdegree Student 8,073 PointsThe comas did it. Thanks a lot.