javascript – 如何修复AlloyUI模式总是出现在图表画布下面?
作者:互联网
我试图像这样使用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>
我错过了什么?
解决方法:
我在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();
标签:yui,javascript,css,alloy-ui 来源: https://codeday.me/bug/20190725/1533826.html