我正在使用以下具有两种模式的代码 “模态画廊”显示模态中的放大图像 当您删除图像时,请单击“ modalgconfirmedelete”。 我希望“ modalgallery”包含下一个和上一个按钮,但是我做不到。 谢谢你的帮助
modalgallery.js
$(function() {
$('.pop').on('click', function() {
$('.imagepreview').attr('src', $(this).attr('data-img-url'));
$(this).next('.imagemodal').modal('show');
});
});
modalconfirmedelete.js
$(function() {
$('.pop2').on('click', function() {
$(this).closest(".imagemodal").next(".delete").modal('show');
});
});
perfil.html
{% for photo in photos %}
<a class="pop" href="#" data-img-url="{{ photo.file.large.url}}"><img src="{{ photo.file.medium.url}}"class="img-thumbnail" width="200" height="200"> </a>
<!-- Modal Gallery-->
<div class="modal fade imagemodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">X</span></button>
<img src="" class="imagepreview" style="width: 100%;" >
<a class="pop2" href="#" ><img src="{% static 'svg/delete.svg' %}" width="20" height="20" alt="">Deletar </a>
</div>
</div>
</div>
</div>
<div class="modal fade delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">X</span></button>
<h2>Tem certeza que deseja deletar essa foto: </h2>
<a href="{% url 'delete' photo.id %}" type="button" class="btn bg-danger text-white js-upload-photos">
<span class="glyphicon glyphicon-cloud-upload"></span> Deletar
</a>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}
{% endif %}