在单击图像时打开滑块,在此之前我已经过滤了图像,所以我想在过滤器之前打开时;滑块显示所有图像,而经过过滤后,仅在滑块上显示经过过滤的图像
<div class="gallery row" id="gallery" style="margin:0;">
<!-- Grid column -->
<div class="mb-3 pics animation all 2 col-md-4 col-sm-12">
<img class="img-fluid" src="assets/images/11.jpg" alt="Card image cap" style="height:300px;" onclick="openModal();currentSlide(1)">
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="mb-3 pics animation all 1 col-md-4 col-sm-12">
<img class="img-fluid" src="assets/images/111.jpg" alt="Card image cap" style="height:300px;" onclick="openModal();currentSlide(2)">
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="mb-3 pics animation all 1 col-md-4 col-sm-12">
<img class="img-fluid" src="assets/images/131.jpg" alt="Card image cap" style="height:300px;" onclick="openModal();currentSlide(3)">
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="mb-3 pics animation all 2 col-md-4 col-sm-12">
<img class="img-fluid" src="assets/images/141.png" alt="Card image cap" style="height:300px;" onclick="openModal();currentSlide(4)">
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="mb-3 pics animation all 2 col-md-4 col-sm-12">
<img class="img-fluid" src="assets/images/151.jpg" alt="Card image cap" style="height:300px;" onclick="openModal();currentSlide(5)">
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="mb-3 pics animation all 1 col-md-4 col-sm-12">
<img class="img-fluid" src="assets/images/121.png" alt="Card image cap" style="height:300px;" onclick="openModal();currentSlide(6)">
</div>
<!-- Grid column -->
</div>`
答案 0 :(得分:2)
您是否尝试过在函数内部编写两个函数?
function main_function($arg){
openModal();
currentSlide($arg);
}
和html
<img class="img-fluid" ... onclick="main_function(6);">