我有以下代码,但是当我在外面点击时,对话框没有关闭。任何帮助?当我按下退出键关闭对话框
var iframe = $('<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2FMypagetest&width&layout=standard&action=like&show_faces=true&share=true&height=80&appId=15226544646" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:80px;" allowTransparency="true"></iframe>');
var dialog = $("<div><br></div>").append(iframe).appendTo("body").dialog({
title: 'Danos un me gusta!',
show: {
effect: "fade",
duration: 150
},
hide: {
effect: "fade",
duration: 150
},
autoOpen: true,
modal: true,
resizable: false,
width: "auto",
height: "auto",
open: function() {
jQuery('.ui-widget-overlay').bind('click', function() {
jQuery('#dialog').dialog('close');
})
}
});
$('.ui-widget-overlay').css('background', 'green');
答案 0 :(得分:0)
$("body").not('#dialog').click( function(e) {
jQuery('#dialog').dialog('close');
});