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

Ryan Southard
Ryan Southard
2,406 Points

Simply doesn't work: No console.log, no black screen.

I've gone through this video and retyped my code verbatim every time. I did the same thing for the prior exercise and couldn't get the console to log anything nor prevent the default "dead end" action. To say this is infuriating is an understatement.

I notice in workspaces that the color of my code doesn't match that in the video, even though the text is -verbatim- what appears in the video. (Don't even suggest that I missed a character -- I'm more than positive that I didn't.)

Here's my app.js:

//Problem: User when clicking on image goes to a dead end //Solution: Create an overlay with the large image - Lightbox

var $overlay = $('<div id="overlay"></div>'); //Add overlay $("body").append($overlay); //An image //A caption

//1. Capture the click event on a link to an image $("#imageGallery a").click(function(event){ event.preventDefault(); var href=$(this).attr("href"); $overlay.show(); //Show the overlay. //Update overlay with the image linked in the link //Get child's alt attribute and set caption

});

//When overlay is clicked //Hide the overlay

And here's my CSS:

overlay {

background:black; width:100%; height:100%; position:absolute; top:0; left:0; }

samiff
samiff
31,206 Points

Can you share a snapshot of your workspace? It's the option in the top right when you have your workspace open near the preview icon.

6 Answers

samiff
samiff
31,206 Points

Ryan, I forked your workspace and it works how it should without changing a thing. Perhaps try viewing the workspace preview in a private browsing window or a different browser. I'm guessing it will work; sometimes cached browsing data can cause weird issues.

Ryan Southard
Ryan Southard
2,406 Points

I'm not following. I clicked that icon, see that it saved, but I don't see where I have the option to share it in this forum.

Hello, Treehouse UX people! This is getting nightmarish.

samiff
samiff
31,206 Points

When you click 'take snapshot' it should generate a link that looks something like https://w.trhou.se/xv8712hquo

Click on the snapshot, then just copy and past that URL. You can have up to five different snapshots at any given time.

Ryan Southard
Ryan Southard
2,406 Points

Thanks, samif! I opened in a private window and that did the trick.

I need a drink now!

samiff
samiff
31,206 Points

Me too :beers: spent quite a bit of time today trying to best remedy collapsing margins!

Sarah Jee Watson
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Sarah Jee Watson
UX Design Techdegree Graduate 28,197 Points

I had the correct code but it wouldn't work in Workspaces no matter what. I pasted it into CodePen and it worked perfectly. So if you're having issues try it in CodePen before you tear your hair out! :)