Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="modal fade" id="myModal">
- <div class="modal-dialog">
- <div class="modal-content bmd-modalContent">
- <div class="modal-body">
- <div class="close-button">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
- </div>
- <div class="embed-responsive embed-responsive-16by9">
- <iframe id="formIframe" class="embed-responsive-item" frameborder="0"></iframe>
- </div>
- </div>
- </div><!-- /.modal-content -->
- </div><!-- /.modal-dialog -->
- </div><!-- /.modal -->
- (function($) {
- $.fn.bmdIframe = function( options ) {
- var self = this;
- var settings = $.extend({
- classBtn: '.bmd-modalButton',
- defaultH: 360
- }, options );
- $(settings.classBtn).on('click', function(e) {
- var allowFullscreen = $(this).attr('data-bmdVideoFullscreen') || false;
- var url = window.location.href;
- var fieldId = "Form_Source_URL";
- var trackingURL = $(this).attr("data-bmdSrc") + '?' + fieldId + '=' + url;
- var dataVideo = {
- 'src': trackingURL,
- 'height': $(this).attr('data-bmdHeight') || settings.defaultH,
- 'width': $(this).attr('data-bmdWidth') || settings.defaultW
- };
- if ( allowFullscreen ) dataVideo.allowfullscreen = "";
- $(self).find("iframe").attr(dataVideo);
- });
- this.on('hidden.bs.modal', function(){
- $(this).find('iframe').html("").attr("src", "");
- });
- return this;
- };
- })(jQuery);
- jQuery(document).ready(function(){
- jQuery("#myModal").bmdIframe();
- });
- //attempted fix to stop body scrolling
- var iframe = document.getElementById('formIframe');
- iframe.addEventListener('touchmove', function(e) {
- e.preventDefault();
- }, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement