Hello, I have the following SCRIPT below. It opens the DIV that is with display: none; but I will have a list of links to open new DIV's and I do not want to be creating new functions to open each DIV.
How could I solve 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>