Question

I'm trying to use AlloyUI diagram and modal together like so:

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();

    ..
});

but modal is always showing up below the diagram no matter what value I set for z-value's. HTML file is structured as such:

<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>

What am I missing?

(jsfiddle here)

Était-ce utile?

La solution

I was playing with z-index attributes in css files but I wasn't able to fix the problem. Today I found a zIndex attribute for modals in js which seems to do the job:

    var modal = new Y.Modal({
        bodyContent: 'Modal body',
        centered: true,
        headerContent: '<h3>Modal header</h3>',
        modal: true,
        render: '#modal',
        zIndex: 1100,
        width: 450
    }).render();
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top