如果我单击弹出框
$(".popup").dialog({
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="css/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$(".popup").dialog({
autoOpen: false,
draggable: true,
title: "Add New Person",
open: function (type, data) {
$(this).parent().appendTo("form");
}
});
$("#body1")
.bind(
'click',
function (e) {
if (
jQuery('.popup').dialog('isOpen')
&& !jQuery(e.target).is('.ui-dialog, a')
&& !jQuery(e.target).closest('.ui-dialog').length
) {
jQuery('.popup').dialog('close');
}
}
);
});
function showDialog(id) {
$('#' + id).dialog("open");
}
function closeDialog(id) {
$('#' + id).dialog("close");
}
</script>
</head>
<body id="body1">
<input type="button" onclick="showDialog('pop101');" value="Popup1" />
<input type="button" onclick="showDialog('pop102');" value="Popup2" />
<input type="button" onclick="showDialog('pop103');" value="Popup3" />
<div style="background: green" id='pop101' class="popup">
</div>
<div style="background: orange" id='pop102' class="popup">
</div>
<div style="background: blue" id='pop103' class="popup">
</div>
</body>
</html>
单击按钮打开一个弹出窗口,当我们在弹出窗口之外单击时,我想隐藏弹出窗口,这怎么可能?