1
Hello, I have the following SCRIPT below. It opens the DIV that is with display:None; however I will have a list of links to open new DIV’s and I don’t want to keep creating new ones to open each DIV.
How could I fix this?
HTML
<a href="javascript:;" onClick="abre();"> Abrir div 01 </a>
<a href="javascript:;" onClick="abre1();"> Abrir div 02 </a>
<div id="box" class="bg-box">
<img src="images/capa-revista.jpg" class="responsive-img">
<a class="" onClick="fechar();"> fechar </a>
</div>
<div id="box" class="bg-box">
<img src="images/capa-revista.jpg" class="responsive-img">
<a class="" onClick="fechar1();"> fechar </a>
</div>
css
.bg-box{
display:none;
width:100%;
height:100%;
background-color:rgba(3, 3, 3, 0.8) !important;
position:fixed; z-index:999;
top:0px;
left:0px;
color:#999;
font-size:16px;
}
JS
<script>
function abre() {
$("#box").fadeIn(700);
}
function fechar() {
$("#box").fadeOut(700);
}
function abre1() {
$("#box1").fadeIn(700);
}
function fechar1() {
$("#box1").fadeOut(700);
}
</script>
just missed the game of old:
abre('#box');
– Ivan Ferrer
But it worked for me?
– Bruno Romualdo
Oh yeah Bruno. Thanks for the help.
– user36373