• Hello,

    Very remedial question. I want the background of a webpage to darken when a popup window is activated. Is there an easy way to accomplish this?

    Thanks.

    • This topic was modified 4 years, 10 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Have the script that opens the popup set CSS style properties of an element that covers the entire page area. A true “popup” is a separate window unaffected by the other windows CSS. I think you are actually referring to a “modal”, which is actually part of the same page. It appears similar to a popup, what its container is is the principal difference. In a modal, it needs to be outside the element you are styling to be darker.

    It’s simplest to set the opacity of the non-modal element to some fraction of 1, but the effect is to lighten and grey out the page, not darken. If it must be darker, you need an overlay element which is normally transparent, but can be set to a darker transparency with RGBA colors such as rgba(0,0,0,0.5).

Viewing 1 replies (of 1 total)
  • The topic ‘Darken Background When Popup Opens’ is closed to new replies.