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 4

My text does not turn white. How do I get my text to turn white.

this code didn't work. I added it to the style.css folder. I'm using chrome browser.

overlay p { color:white;}

Jason Berteotti
Jason Berteotti
12,352 Points

That should work given everything else is correct, so it must not be. Two possibilities: 1) overlay p doesn't exist. 2) CSS prior to that rule is not correct, so everything after it is not being processed. Might need to share the rest of your code.

//This is the app.js folder<b> //Problem: User when clicking on image goes to a dead end<b> //Solution: Create an overlay with the large image - Lightbox<b> <b> var $overlay = $('<div id="overlay"></div>');<b> var $image = $("<img>");<b> var $caption = $("<p></p>");<b> <b><b> //An image to overlay<b>

$overlay.append($image);```
<b><b>
```//A caption to overlay```<b>
```$overlay.append($caption);```<b>
<b><b>
```//Add overlay```<b>
```$("body").append($overlay);```<b>
  <b><b>
<b><b>

```//1. Capture the click event on a link to an image```<b>
```$("#imageGallery a").click(function(event){```<b>
 ``` event.preventDefault();```<b>
 ``` var imageLocation = $(this).attr("href");```<b>
```  //Update overlay with the image linked in the link```<b>
  ```$image.attr("src", imageLocation);```<b>
  <b><b>
 ``` //Show the overlay```<b>
 ``` $overlay.show();```<b>
<b><b>
<b><b>
  ```//Get child's alt attribute and set caption```<b>
  ```var captionText = $(this).children("img").attr("alt");```<b>
  ```$caption.text(captionText);```<b>
```});```<b>
<b><b>
<b><b>
<b><b>
```//When overlay is clicked```<b>
```$overlay.click(function(){```<b>
 ``` $overlay.hide();```<b>
```});```<b>
  ```//Hide the overlay```<b>

1 Answer

Aaron HARPT
Aaron HARPT
19,845 Points

overlay is an id so you need to do: #overlay p