Lightbox window follow the screen (Sidebar)

1

I have a code where I can load DIV mine into lightbox, but when I roll the browser window down the lightbox window does not match. I've tried putting it as position: fixed, but so Z-index does not work!

FOLLOW 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>

HERE IS CSS DESSA 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;
        }
    
asked by anonymous 22.01.2017 / 21:02

0 answers