Nec
Nec

Reputation: 178

css popup disable scroll on page

I am doing a popup light box by using the code I found in this article HTML / CSS Popup div on text click.

Now I am trying to disable the main scrolling of the page, since the light box has a fixed height, but certain pages are longer then the popup which leads to scrolling the background of the popup which in this case is the page itself.

I played a bit with overflow but without success.

Upvotes: 0

Views: 2828

Answers (1)

Guido Bouman
Guido Bouman

Reputation: 3275

Try the following CSS:

html {
  height: 100%;
  overflow: hidden;
}

Also, if you trigger this code on a random location in the page, you might need to do extra work.

Do you have a jsfiddle or codepen?

Upvotes: 3

Related Questions