Полностью новый в этом мире, но я просто обожаю его, и я хочу извлечь из него все возможное. Я делаю свой собственный фотосессия, и я застрял здесь со следующей/предыдущей кнопкой в модальной форме. Что делать?Следующие/предыдущие кнопки для добавления в модальный
<img id="myImg" src="myimage" alt="wjuuuu" width="760" height="478">
<!-- The Modal -->
<div id="myModal" class="modal">
<span class="close">×</span>
<img class="modal-content" id="img01">
<div id="caption"></div>
</div>
<script>
// Get the modal
var modal = document.getElementById('myModal');
// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.getElementById('myImg');
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption");
img.onclick = function(){
modal.style.display = "block";
modalImg.src = this.src;
captionText.innerHTML = this.alt;
}
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
</script>
Я не понимаю, что вы хотите сделать, в вашем HTML не существует «предыдущей» или «следующей» кнопки. И что должно произойти при нажатии? – ValLeNain
Я бы хотел, чтобы tike добавил следующую и предыдущие стрелки к этому html, который я уже создал. но я не знаю, как это сделать. –