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

Problem in append method (JQuery)

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

// 2. Add Overlay // 2.1 An image // 2.2 Caption var $overlay=$('<div id="overlay"></div>'); $("body").append($overlay);

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

}); // 3. When overlay is clicked // 3.1 hide the overlay

In here append($overlay) is not working please help me out with this ...

Can you please use markdown sheet to display your code, there is a link down Markdown cheatsheet, use that .

Steven Parker
Steven Parker
243,656 Points

Even better, make a snapshot of your workspace and post the link to it here.

https://w.trhou.se/jt81ml0y1x

This is the snapshot ...

1 Answer

Hi,

Your issue is simple, from what I've seen on your code, you didn't use the right alpha on your rgb function background:rgba(0,0,0,0.7) in the styles.css file for your #overlay selector ; the last digit should be 0.7 for semi-transparent but not 7, you wrote 7 which means nothing and the entire overlay becomes black. your code however is not complete, you haven't added an image yet and the remove functionality is still not added. Hope this makes sense.