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!

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


Ashley Dillon
Ashley Dillon
9,092 Points

jQuery overlay size problems

I am trying to integrate a lightbox into a personal project, and I am starting with an overlay. The problem is the overlay will not span the full height of the page.

Here's my code:


var $overlay=$('<div id="overlay"></div>');





background:rgba(0,0,0,0.7); width:100%; height:100%; position:absolute; top:0; left:0; display:none; }

2 Answers

Michal Kurtulík
Michal Kurtulík
9,203 Points

you tray frst row this var $overlay = $('<div id="overlay"></div>');

Hi Ashley,

I have successfully integrated the lightbox project to my portfolio.

This var $overlay=$(''); is an empty Jquery object that you are creating, and in consequence you are appending "nothing" to your body tag, it should be:

 var $overlay = $(<div id="overlay"></div>);