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 3

Dan Putnam
seal-mask
.a{fill-rule:evenodd;}techdegree
Dan Putnam
Front End Web Development Techdegree Student 8,596 Points

overlay shows up before click? EDIT: Workspace issue -clear cache

EDIT: literally copied and pasted from the project files and they will not work in my browser chrome, I guess I'll avoid workspaces.

EDIT 2: cleared the cache a couple times and now it works

my project is the same code as his from the video, but my overlay shows up right as the page loads. I don't see how. p.s. the code markup isn't working either...

http://port-80-az372rd1sp.treehouse-app.com/

//Problem user shouldn't go to a new page dead end when clicking image //solution- create overlay w large image

var $overlay = $('<div id="overlay"></div>'); var $image = $("<img>");

$overlay.append($image);

// add overlay $("body").append($overlay); // image // caption

// capture click on a link to image $("#imageGallery a").click(function(event){ event.preventDefault(); var imageLocation = $(this).attr("href");

// update overlay with image linked in the link $image.attr("src", imageLocation);

// show overlay
$overlay.show();

// add alt as a caption

});

//on overlay click remove overlay

Had the same problem. Your solution worked.

In my case neither Chrome, nor Firefox was showing overlay.