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 trialSrdjan Cestic
6,855 PointsWhere I make mistake?
When I click on photo it go to ''dead end'', but I put event.preventDefault already. https://w.trhou.se/hkdmvy75sx
2 Answers
Sergey Podgornyy
20,660 PointsFirst, you have conflicting double quotes in your JavaScript file:
var $overlay = $("<div id = "overlay"></div>");
It must be like this:
var $overlay = $("<div id ='overlay'></div>");
Second, add height property to #overlay
element:
#overlay {
background:rgba(0,0,0,0.7);
width:100%;
height:100%;
position:absolute;
top:0;
left:0;
display:none;
text-align:center;
}
You can also compare your code with mine - https://github.com/SergeyPodgornyy/treehouse-projects/tree/master/jquery/3_-_Image_gallery
edeharrison
Full Stack JavaScript Techdegree Student 11,127 PointsHi Srdjan,
It looks like you have conflicting double quotes here which is probably causing a problem:
var $overlay = $("<div id = "overlay"></div>");
It should be something like this:
var $overlay = $("<div id = 'overlay'></div>");
or:
var $overlay = $('<div id = "overlay"></div>');
Hope that helps,
Ede
Srdjan Cestic
6,855 PointsHi Ede, I changed it, but when I click now I don't go anywhere, before I go to ''dead end'', now I don't get any respond.
edeharrison
Full Stack JavaScript Techdegree Student 11,127 PointsHi Srdjan,
Ah, sorry then. I'm not familiar with that course so I don't know what the problem would be. I just wanted to point out the code error in case that was the issue.
Good luck,
Ede
Srdjan Cestic
6,855 PointsSrdjan Cestic
6,855 PointsThanks for help Sergey and sorry for late reply! :)
Sergey Podgornyy
20,660 PointsSergey Podgornyy
20,660 PointsYou are welcome ;)