tags:

views:

33

answers:

2

I want to show some dialog (absolute positioned div), and I want to show it above semitransparent 100% div, so everything on background will be dimmed. I have managed it by

<div class='transpBox'></div>

.transparentBox
{
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    background-color: #white;
    opacity: 0.9;
    z-index: 499;
}

This is all right, but when dialog height is more than browser height and you scroll down, you see that transparent div is not in full screen. What is proper way to make such thing?

+2  A: 

Instead of position: absolute, use position: fixed. (Use it with your dialog div too.)

absolute positions based on the page, fixed positions based on the window.

Casey Hope
Except for IE6.
SLaks
Why is this answer marked Community Wiki? This is by the way not the first answer you unnecessarily marked CW.
BalusC
Im' sorry. I'm new here. What should I do? This answer helps me. =)
@Balus, yeah, right after I posted this, I decided to actually Google what that meant instead of mindlessly checking the box.
Casey Hope
@plasticrabbit: this comment was targeted to Casey :) @Casay: okay :)
BalusC
+1  A: 

maybe you should try jquery modal dialogs. Rather than creating your own process in doing it. DOing so will give you the semitransparent background and a dialog foreground.

Hanseh