How do I get the background to stop scrolling when I open my modal window? I already tried some options with javascript but all continue scrolling.
Follow the code:
HTML:
<div id="openModal" class="modalDialog">
<div class="body">
<div class="teste3">
<div class="teste2">
<a href="#close" title="Close" class="close">X</a>
<iframe class="teste" src="https://pt.stackoverflow.com/"></iframe></div></div></div></div><pclass="parah"><span class="ph"><a href="#openModal2"><img alt="Illustration" src="../Images/video.png" /></a></span> <strong>Vídeo 3.2</strong> Texto para testar o segundo video desse livro.</p>
CSS:
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.8);
z-index: 99999;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target {
opacity:1;
pointer-events: auto;
position: fixed;
}
.modalDialog > div {
width: 640px;
position: relative;
margin: 10% auto;
}
.close {
background: crimson;;
color: #FFFFFF;
line-height: 30px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 30px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
cursor: pointer;/**/
z-index: 1;
}
.close:hover { background: red; }
.teste {
position: absolute;
top: 0;
left: 0;
width: 100% !important;
height: 100% !important;
}
.teste2 {
position: relative;
width: 100%;
max-width: 100%;
padding-top: 56.5%;
}
.teste3 {
width: 640px;
margin: auto;
}
.body {
padding:0.75em 10.5%;/*0.75em 10.5%;*/
margin-top: 2em;
margin-bottom: 5em;
text-align: center;
clear: both;
}