Skip to content Skip to sidebar Skip to footer

Javascript Custom Alert Box Transparency Issue

I'm trying to do an image-based custom alert box using CSS and Javascript. I almost have it working the way I want it to. The issue that's been plaguing me is that box is sharing t

Solution 1:

This is because your content div is a child of the transparent div. (And thus inherits the opacity from #popUpDisplay.) Which is why frameworks like Bootstrap place a modal-overlay before (not around) the content div of a modal.

I would just update your CSS to use rgba on the background of #popUpDisplay:

#popUpDisplay{
  display: none;
  /* opacity: .8; <-- remove this */position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(211, 211, 211, .8); /* <-- change this*/z-index: 8;
}

Post a Comment for "Javascript Custom Alert Box Transparency Issue"