@Guilherme, for this you need a common element among all the mirror. For example look at the HTML below:
HTML
<div id="mirror30" data-mirror class="hidden" ></div>
<div id="mirror31" data-mirror ></div>
<div id="mirror32" data-mirror ></div>
<div id="mirror33" data-mirror ></div>
<div id="mirror34" data-mirror class="hidden" ></div>
<div id="add4mirror" data-mirror ></div>
CSS
.hidden { display: none; }
In the above case, all mirrors have the data-mirror property, so you can use it to select all of them.
As you only need the visible ones, you can apply a filter :visible
$("[data-mirror]:visible").hide("slow");
var btHidden = $("#btHidden");
btHidden.click(function () {
var visibleMirror = $("[data-mirror]:visible");
visibleMirror.hide("slow");
});
.hidden { display: none; }
.container {
height: 120px;
}
.mirror {
float: left;
background-color: whitesmoke;
width: 100px;
height: 100px;
box-shadow: 0px 0px 10px black;
margin: 10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divclass="container">
<div id="mirror30" data-mirror class="mirror hidden" ></div>
<div id="mirror31" data-mirror class="mirror" ></div>
<div id="mirror32" data-mirror class="mirror" ></div>
<div id="mirror33" data-mirror class="mirror" ></div>
<div id="mirror34" data-mirror class="mirror hidden" ></div>
<div id="add4mirror" data-mirror class="mirror" ></div>
</div>
<button id="btHidden" >Esconder Tudo</button>