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
troy beckett
12,035 Pointsno 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
28,686 PointsIf you mean that the lightbox is scrolling with the page, you could try setting the lightbox container to position: fixed
.

Ryan Field
Courses Plus Student 21,241 PointsIn 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.