Dojo Dialog不想阻止整个页面

时间:2017-01-10 23:54:25

标签: dojo

我在对话框中显示一个没有问题的网格。但问题是,对话框阻挡了整个页面的背景。反正有没有避免它?即,一旦显示对话框,用户仍然可以访问像Tab等页面元素。

2 个答案:

答案 0 :(得分:0)

使用CSS是可能的。当您创建Dialog并为其提供id属性时,它将创建一个跨越整个页面的基础<div>,这样您就无法点击除新基础{{1 }}。幸运的是,您可以使用CSS隐藏这样的元素,并且因为元素的ID生成为<div>,您可以这样做:

#<ID of dialog>_underlay
require(['dijit/Dialog', 'dijit/form/Button', 'dojo/domReady!'], function(Dialog, Button) {
  var dialog = new Dialog({
    id: 'test',
    title: 'Test',
    content: 'Hello world'
  });

  new Button({}, 'btn').on('click', function() {
    dialog.show();
  });
});
/* "test" is the ID of the dialog, so I need to use #test_underlay */
#test_underlay {
  /* Setting this property to none hides the element */
  display: none;
}

答案 1 :(得分:0)

您可以使用Dojo的FloatingPane代替Dialog。它的工作方式大致相同,您可以使用它下面的对象。

相关问题