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 trialShane He
7,618 Pointswhy isn't this working on my browser
//
var $overlay = $('<div id="overlay"></div>');
var $image = $("<img>");
var $caption =$("<p></p>");
$overlay.append($image);
$overlay.append($caption);
$("body").append($overlay);
$("#imageGallery a").click(function(event){
event.preventDefault();
var imageLocation = $(this).attr("href");
$image.attr("src", imageLocation);
$overlay.show();
});
$overlay.click(function(){
$overlay.hide();
});
//
1 Answer
Ryan Duchene
Courses Plus Student 46,022 PointsOn the fourth line of code, you've misspelled $image
as $iamge
. Other than that, it looks pretty good!
Shane He
7,618 Pointsthank you ryan. i just did that. and it's still funky..
Ryan Duchene
Courses Plus Student 46,022 PointsWhat browser are you using, and what version? Also, can you open your console (Opt-Cmd-C on Mac, Alt-Ctrl-C on Windows) in your browser and see if there are any errors? If so, what do they say?
Shane He
7,618 Pointsi'm using the most updated version of chrome on my mac. nothing logs in the console. no errors here... :/
Ryan Duchene
Courses Plus Student 46,022 PointsHmm...if it's at all possible, can I get a screenshot? Also, do you currently have any CSS on the page? If so, do you have any that specifically target the gallery/overlay?
Shane He
7,618 Pointsha! figured it out. the problem was in the css alignment and positioning. thanks for trouble shooting. :)
Ryan Duchene
Courses Plus Student 46,022 PointsGlad I could help!
Ryan Duchene
Courses Plus Student 46,022 PointsRyan Duchene
Courses Plus Student 46,022 PointsEdited your comment to add syntax highlighting. :)