abrir modal na pagina seguinte
Olá pessoal. O modal abaixo abre normalmente na pagina1.php Estou tentando abrir o modal na pagina2.php da seguinte forma: Clicar na imagem que está na pagina1 e abrir o modal na pagina2 . Alguma ideia de como fazer isso? Obrigado !
pagina1.php
<style>
#myImg {
border-radius: 5px;
cursor: pointer;
transition: 0.3s;
}
#myImg:hover {opacity: 0.7;}
.modal {
display: none;
position: fixed;
z-index: 1;
padding-top: 100px;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
}
.content {
margin: auto;
display: block;
width: 80%;
max-width: 700px;
-webkit-animation-name: zoom;
-webkit-animation-duration: 0.6s;
animation-name: zoom;
animation-duration: 0.6s;
}
@-webkit-keyframes zoom {
from {-webkit-transform:scale(0)}
to {-webkit-transform:scale(1)}
}
@keyframes zoom {
from {transform:scale(0)}
to {transform:scale(1)}
}
.fechar {
position: absolute;
top: 15px;
right: 35px;
color: #f1f1f1;
font-size: 40px;
font-weight: bold;
transition: 0.3s;
cursor: pointer;
}
</style>
**...**
<!-- <a href="" id=""></a> -->
<img id="myImg" src="img_snow.jpg" style="width:100%;max-width:300px">
<div id="myModal" class="modal">
<span class="fechar">×</span>
<img class="content" id="img01">
</div>
**...**
<script>
var modal = document.getElementById("myModal");
var img = document.getElementById("myImg");
var modalImg = document.getElementById("img01");
img.onclick = function(){
modal.style.display = "block";
modalImg.src = this.src;
}
var span = document.getElementsByClassName("fechar")[0];
span.onclick = function() {
modal.style.display = "none";
}
</script>Discussão (1)
Carregando comentários...