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 with jquery courses: my workspace has some problem with rgba and position

this is my code: javascript:

//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>');
var $image = $("<img>");
$("body").append($image);
$("body").append($overlay);


$("#imageGallery a").click(function(event){
  event.preventDefault();

var imagelocation = $(this).attr("href");
  $image.attr("src", imagelocation);

  $overlay.show();

});

and css

#overlay {
 background: rgba(0,0,0,0,7);
  width:100%;
  height:100%;
  position:absolute;
  top:0;
  left:0;
  display:none;
}
#overlay img {margin-top: 30%;}

but the img is not at top left and the screen doesn't become more black as in the course... why?

thx

your rgba is written wrong. It should be like: background: rgba(0,0,0,0.7); Notice the . insted of , at the end there.

2 Answers

Looks like your rgba has an extra element. Please try background: rgba(0,0,0,.7);

Where it should be 0.7 for opacity you've got a comma 0,7