P
P
Petr Fronin2016-07-26 19:27:37
Bootstrap
Petr Fronin, 2016-07-26 19:27:37

How to disable video playback (vimeo) on modal close in Bootstrap3?

There is this code:

<a data-toggle="modal" data-target=".myModal">Large modal</a>

                                <div class="modal fade myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
                                    <div class="modal-dialog modal-lg" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                                <h4 class="modal-title" id="myModalLabel">Modal title</h4>
                                            </div>
                                            <div class="modal-body">
                                                <iframe src="https://player.vimeo.com/video/175552262" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                                <button type="button" class="btn btn-primary">Save changes</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

The modal window opens and the video can be launched in it and everything works! But there is one drawback, if you close the window while viewing, the video continues to play in the background! How to stop video when modal closes?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question