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

troy beckett
troy beckett
12,035 Points

no scroll on light box???

I've got a lightbox but where my webpage is longer than just the screen I'm able to still scroll up and down. How would I stop this.

2 Answers

Sean T. Unwin
Sean T. Unwin
28,690 Points

If you mean that the lightbox is scrolling with the page, you could try setting the lightbox container to position: fixed.

Ryan Field
PLUS
Ryan Field
Courses Plus Student 21,242 Points

In addition to what Sean has said, if you're trying to stop the entire page from scrolling (so the background doesn't scroll while the lightbox is open), you can add overflow: hidden; to the main wrapper for your page via JavaScript and then change it back to visible upon dismissal of the lightbox.