Blueimp Gallery inside the Modal with black screen

Asked

Viewed 166 times

1

Follows code:

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <!-- The Gallery as inline carousel, can be positioned anywhere on the page -->
        <div id="blueimp-gallery-carousel" class="blueimp-gallery blueimp-gallery-carousel">
          <div class="slides"></div>
          <h3 class="title"></h3>
          <a class="prev">‹</a>
          <a class="next">›</a>
          <a class="play-pause"></a>
          <ol class="indicator"></ol>
        </div>
      </div>
      <div id="links" hidden>
        <a href="http://www.aprenderexcel.com.br//imagens/noticia/385/2901-1.jpg"></a>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

JS:

blueimp.Gallery(
  document.getElementById('links').getElementsByTagName('a'), {
    container: '#blueimp-gallery-carousel',
    carousel: true
  }
);

Segue Jsfiddle: https://jsfiddle.net/dx9ou7ag/1/

When I open modal, gets black screen.

Final result:

inserir a descrição da imagem aqui

Some solution ?

  • I did the test on the link you passed, it starts black, then the image appears

  • Just this snippet of javascript code ?

  • The problem is when using with the bootstrap if you use it alone, it works.

  • That’s what I meant. rs

  • @Souza, the following link: https://jsfiddle.net/dx9ou7ag/3/

  • Put as answer, so in the future if someone has the same problem, has the solution.

  • I’ll put it on later, thanks for helping me

Show 2 more comments

1 answer

0


Problem solved,

Putting the following code:

$('#exampleModal').on('shown.bs.modal', function(e) {
  blueimp.Gallery(
    document.getElementById('links').getElementsByTagName('a'), {
      container: '#blueimp-gallery-carousel',
      carousel: true
    }
  );
})

Browser other questions tagged

You are not signed in. Login or sign up in order to post.