Last active
April 18, 2019 04:01
-
-
Save krugazul/e5eb0e9cd618e6fbc92ffb8005864e97 to your computer and use it in GitHub Desktop.
jQuery - Load an iframe on Bootstrap Modal Shown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(document).ready(function() { | |
| jQuery("#videoModal").on('shown.bs.modal', function(){ | |
| jQuery('#videoModal iframe').attr('src', jQuery('#videoModal iframe').attr('data-src') ); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * The video html | |
| */ | |
| <a href="#videoModal" target="_self" class="lsx-button" rel="noopener noreferrer" data-toggle="modal">Watch The Video</a> | |
| <div class="modal fade" id="videoModal" tabindex="-1" role="dialog" aria-labelledby="videoModalLabel" aria-hidden="true"> | |
| <div class="modal-dialog" 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">×</span> | |
| </button> | |
| </div> | |
| <div class="modal-body"> | |
| <iframe width="100%" height="600" data-src="{url}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment