Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. <div class="modal fade" id="myModal">
  2. <div class="modal-dialog">
  3. <div class="modal-content bmd-modalContent">
  4. <div class="modal-body">
  5. <div class="close-button">
  6. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  7. </div>
  8. <div class="embed-responsive embed-responsive-16by9">
  9. <iframe id="formIframe" class="embed-responsive-item" frameborder="0"></iframe>
  10. </div>
  11. </div>
  12. </div><!-- /.modal-content -->
  13. </div><!-- /.modal-dialog -->
  14. </div><!-- /.modal -->
  15.  
  16. (function($) {
  17. $.fn.bmdIframe = function( options ) {
  18. var self = this;
  19. var settings = $.extend({
  20. classBtn: '.bmd-modalButton',
  21. defaultH: 360
  22. }, options );
  23. $(settings.classBtn).on('click', function(e) {
  24. var allowFullscreen = $(this).attr('data-bmdVideoFullscreen') || false;
  25. var url = window.location.href;
  26. var fieldId = "Form_Source_URL";
  27. var trackingURL = $(this).attr("data-bmdSrc") + '?' + fieldId + '=' + url;
  28.  
  29. var dataVideo = {
  30. 'src': trackingURL,
  31. 'height': $(this).attr('data-bmdHeight') || settings.defaultH,
  32. 'width': $(this).attr('data-bmdWidth') || settings.defaultW
  33. };
  34.  
  35. if ( allowFullscreen ) dataVideo.allowfullscreen = "";
  36.  
  37.  
  38. $(self).find("iframe").attr(dataVideo);
  39.  
  40.  
  41. });
  42.  
  43.  
  44. this.on('hidden.bs.modal', function(){
  45. $(this).find('iframe').html("").attr("src", "");
  46. });
  47.  
  48. return this;
  49. };
  50.  
  51. })(jQuery);
  52.  
  53. jQuery(document).ready(function(){
  54. jQuery("#myModal").bmdIframe();
  55.  
  56. });
  57.  
  58. //attempted fix to stop body scrolling
  59. var iframe = document.getElementById('formIframe');
  60. iframe.addEventListener('touchmove', function(e) {
  61. e.preventDefault();
  62. }, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement