<div class="container">        <div id="gallery" class="container-fluid">            <img src="/images/landscaping.jpeg" class="img-responsive">        </div>        <div id="myModal" class="modal"">        </div></div>

Please edit the question to reflect the specific problem with enough detail to be able to give an adequate answer.

Дух сообщества2022-02-12 22:24:14
  • Answer # 1

    It's not clear what problem you're facing. Add click handlers for images. Add an img tag to the modal. On click, get the src of the clicked one, and put it in the src of the modal. Display modal.

    $("#gallery img").click(function(){
        $("#target-img").attr('src', $(this).attr('src'));