Make Modal capture figcaption

穿精又带淫゛_ 提交于 2019-12-24 19:09:10

问题


so I have this code for a fig caption and a modal to show up on mobile and tablets, but I would like to make the modal open my caption instead of writing the caption again inside the modal.

I have many images with captions, so this with be optimal

How is this possible?

Thanks

<div class="col-5 col-sm-2 ml-auto aboutMid aboutMid1">
                            <figure class="cap-left">

                                <img src="http://www.classichits.ie/wp-content/uploads/2016/12/house.png" class="img-fluid">
                                <a href="#myModal" role="button" data-toggle="modal" class="d-inline d-lg-none"><figcaption>
                                    The house is a converted farm building featuring traditional wooden shutters and terracotta toof tiles
                                    </figcaption></a>
                                <figcaption class="d-none d-lg-inline">
                                    The house is a converted farm building featuring traditional wooden shutters and terracotta toof tiles
                                </figcaption>
                            </figure>

                        </div>

                        <!-- Modal -->
                        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="#myModal" aria-hidden="true">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title" id="ModalLabel">Here is a 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">
                                        Here goes the content of the modal.
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                        <button type="button" class="btn btn-warning">Save</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-5 col-sm-2 mr-auto mr-sm-0 aboutMid aboutMid1">
                            <figure class="cap-left">
                                <img src="assets/about/about2.jpg" class="img-fluid">
                                <figcaption>
                                    The large garden features breathtaking views of the valley and Puilaurens Castle                                 </figcaption>
                            </figure>
                        </div>

来源:https://stackoverflow.com/questions/48382877/make-modal-capture-figcaption

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!