user2993018 user2993018 - 2 years ago 65
HTML Question

How do I make my lightbox not scroll? I have this site when you go to the my works section and click a thumbnail a lightbox will appear it's working fine but how can I make it not non-scrollable while it is on lightbox?


<!-- thumbnail image wrapped in a link -->
<a href="#img1">
<img alt="Eiffel Tower Web Design Mockup - Mark That RedWeb Design Mockup" class="works-feature-thumb" src="images/lightbox-1-t.jpg"/>
<!-- lightbox container hidden with CSS -->
<a href="#_" class="lightbox" id="img1">
<img alt="Law Attorney Web Design Mockup - Mark That Red Web Design Mockup Philippines" src="images/lightbox-1.jpg"/>


.lightbox {
/** Default lightbox to hidden */
display: none;

/** Position and style */
position: fixed;
z-index: 999;
width: 100%;
height: 100%;
text-align: center;
top: 0;
left: 0;
background: rgba(0,0,0,0.8);

.lightbox img {
/** Pad the lightbox image */
max-width: 95%;
max-height: 90%;
margin-top: 2%;

.lightbox img:hover {
opacity: 1;

.lightbox:target {
/** Remove default browser outline */
outline: none;

/** Unhide lightbox **/
display: block;
overflow: hidden;

Answer Source

If you add this script it will work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download