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 trialAshley Dillon
9,092 PointsjQuery 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:
jQuery:
var $overlay=$('<div id="overlay"></div>');
$("body").append($overlay);
$overlay.show();
css:
overlay{
background:rgba(0,0,0,0.7); width:100%; height:100%; position:absolute; top:0; left:0; display:none; }
2 Answers
Michal Kurtulík
9,203 Pointsyou tray frst row this var $overlay = $('<div id="overlay"></div>');
nnuxiragwh
10,345 PointsHi 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>);
Regards,
Tomek