Open Modal without changing page position

0

Expensive;

I use Modal Bootstrap within a While to show images captured within my Database

When I have several lines, with several images, when opening the last ones for example, the Popup opens without problems, but the page returns to the top. Is there any way to leave the page in the same position as the modal popup?

Script that opens Modal

<script>

$(".abrirModal").click(function() {
   var url = $(this).find("img").attr("src");
  $("#myModal img").attr("src", url);
  $("#myModal").modal("show");
});

</script>

While in PHP to show the modal when clicked:

<td><a href="#"  class="abrirModal"><img width=40px" height="40px" src ="imagem/<?php echo $fetch['imagem']; ?>" /></td>

I tried to use the solution of this question, but my page back to the top and when I cancel the modal, I lose the scrollbar:

Prevent Screen Scrolling When Opening Modal

    
asked by anonymous 26.04.2018 / 23:07

0 answers