Lightbox window follow the screen (Sidebar)

Asked

Viewed 89 times

1

I have a code where I can load my DIV into lightbox, but when I roll the browser window down the lightbox window does not accompany. I tried to put as position: fixed, but so the Z-index does not work!

FOLLOWS THE CODE:

<script type="text/javascript">

        function Abrir()
        {
            document.getElementById('light').style.display= 'block';
            document.getElementById('fade').style.display='block';      
        }

        function Fechar()
        {
            document.getElementById('light').style.display='none';
            document.getElementById('fade').style.display='none';       
        }


    </script>

This is the part of the code that contains the contents of the DIV:

<div id="form1" runat="server" style="text-align:left;">
<p>
<a href="javascript:void(0)" onclick="Abrir();"><img src="images/logo_cardapio.png"></a>
</p>

<div id="light" class="conteudo">

<div class="fechar"><a href="javascript:void(0)" onclick="Fechar();"><img src="images/close-bardana.png"></a></div>

AQUI VEM O CONTEÚDO DA DIV

</div>
<div id="fade" class="overlay">
</div>
</div>

THIS IS THE CSS OF THIS LIGHTBOX:

.overlay {
            display: none;
            position: absolute;
            top: 0%;
            left: 0%;
            width: 100%;
            height: 300%;
            background-color: black;
            z-index: 1001;
            -moz-opacity: 0.8;
            opacity: .50;
            filter: alpha(opacity=70);
        }

.conteudo {
            display: none;
            position: absolute;
            top: 10%;
            left: 14%;
            right: 15%;
            width: 70%;
            height: 70%;
            padding: 12px;
            border: 16px solid #7dae41;
            background-color: white;
            z-index: 1002;
            overflow: auto;
        }
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.