If the user clicks an external link, the jQuery UI dialog appears with "ok" and "cancel" buttons and when they hit "ok" it should take them to the external site.
Everything is working as expected, but the problem is with the modal:true;
when the dialog is on the user is able to work on the background and I want the background to be grayed out when the popup is on.
$(window).on('load', function(){
$.expr[":"].external = function(a) {
var linkhn = a.hostname.split('.').reverse();
var linkHref = linkhn[1] + "." + linkhn[0];
var domainhn = window.location.hostname.split('.').reverse();
var domainHref = domainhn[1] + "." + domainhn[0];
return !a.href.match(/^mailto\:/) && !a.href.match(/^tel\:/) && linkHref !== domainHref;
};
$("a:external").addClass("ext_link");
});
$(document).ready(function(){
jQuery(document).on("click", ".ext_link", function () {
$("<div>Thank you for visiting You are now being taken to an external site. </div>").dialog().attr('id','dialog-confirm').css('display','none');
var link_val = this;
$('#dialog-confirm').dialog({
title: "External Link",
height: "auto",
width: 410,
resizable: false,
modal: false,
buttons: {
"Ok": function() {
window.open( link_val.href); $(this).dialog("close"); $(this).dialog('destroy').remove();
},
Cancel: function () {jQuery(this).dialog("close"); $(this).dialog('destroy').remove() ;}
}
}).dialog("widget").find(".ui-dialog-titlebar").hide();
return false;
});
});
modal: true
there's a layer placed over the background that swallows events outside the dialog box. If that isn't working then something else is at play.