我使用the example创建了一个dojo对话框。我在后台使用地图。问题是,当对话框出现时,背景被阻止,我无法使用地图(没有底层的对话框)。当对话框出现在背景上时,有没有办法启用背景?
答案 0 :(得分:1)
你可以用一点点黑客来做:
require(["dijit/Dialog", "dijit/DialogUnderlay", "dojo/domReady!"], function(Dialog, DialogUnderlay){
//just for the snippets to get the right styling
document.body.className = "tundra";
myDialog = new Dialog({
title: "My Dialog",
content: "Test content.",
style: "width: 300px"
});
myDialog2 = new Dialog({
title: "My Dialog",
content: "Test content.",
style: "width: 300px"
});
showDialog2 = function () {
myDialog2.show().then(function() {
DialogUnderlay.hide()
//little hack to avoid JS error when closing the dialog
DialogUnderlay._singleton.bgIframe = {destroy: function() {}}
});
}
});

<script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"></script>
<link rel="stylesheet" type="text/css" href="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/resources/dojo.css">
<link rel="stylesheet" type="text/css" href="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dijit/themes/tundra/tundra.css">
<button onclick="myDialog.show();">show with underlay</button>
<button onclick="showDialog2();">show without underlay</button>
&#13;