Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript jQuery Basics (2014) Creating a Simple Lightbox Perform: Part 1

Martin Bornman
PLUS
Martin Bornman
Courses Plus Student 12,662 Points

jQuery

I am doing exactly as the video.When I log in the preventDefault is not turned of.The code is exactly as in the video but get a different result in console.What is wrong with my code?I practise on my own project. // Problem: When clicking on image,go to a dead end // Solution: Create an overlay with the large image - ligthbox

// Plan: // 1.Capture the click event on a link to an image $("#imageGallery a").click(function(event) { event.preventDefault(); var href = $(this).attr("href"); console.log(href); // 1.1 Show the overlay // 1.2 Update overlay with the image linked in the link // 1.3 Get child attribute and set caption - can use the href attribute // 2. Add an overlay }) // 2.1 An image // 2.2 A caption ? // 3. When overlay is clicked // 3.1 Hide the overlay

please create snap of your workspace and paste url here

1 Answer