如何修复AlloyUI模式总是出现在图表画布下面?

时间:2013-07-12 17:05:32

标签: javascript css yui alloy-ui

我正在尝试像这样使用AlloyUI图和模态:

var Y = YUI().use(
    'aui-diagram-builder',
    'aui-button',
    'aui-modal',
function (Y) {
    var availableFields = [{
        iconClass: 'aui-diagram-node-start-icon',
        label: 'Start',
        type: 'start'
    }, {
        iconClass: 'aui-diagram-node-task-icon',
        label: 'Task',
        type: 'task'
    }];

    var diagram = new Y.DiagramBuilder({
        availableFields: availableFields,
        boundingBox: '#myDiagramContainer',
        srcNode: '#myDiagramBuilder'
    }).render();

    var modal = new Y.Modal({
        bodyContent: 'Modal body',
        centered: true,
        headerContent: '<h3>Modal header</h3>',
        modal: true,
        render: '#modal',
        width: 450
    }).render();

    ..
});

但无论我为z值设置了什么值,模态总是显示在图表下方。 HTML文件的结构如下:

<div id="myDiagramContainer">
    <div id="myDiagramBuilder"></div>
</div>

<button id="showModal" class="aui-btn">Show Modal</button>
<div class="yui3-skin-sam">
    <div id="modal"></div>
</div>

我错过了什么?

jsfiddle here

1 个答案:

答案 0 :(得分:8)

我在css文件中使用z-index属性,但我无法解决问题。今天我在js中找到了一个zIndex个模态属性,似乎可以完成这项任务:

    var modal = new Y.Modal({
        bodyContent: 'Modal body',
        centered: true,
        headerContent: '<h3>Modal header</h3>',
        modal: true,
        render: '#modal',
        zIndex: 1100,
        width: 450
    }).render();