我在一个项目中使用 simplemodal OSX,我希望当用户在弹出窗口之外单击时关闭模式弹出窗口。我使用以下代码将overlayClose 设置为true,但这不起作用。X 按钮可以正常工作,但在外部单击时则不行;
$("#osx-modal-content").modal({
autoPosition: true,
autoResize: false,
overlayId: 'osx-overlay',
containerId: 'simplemodal-container',
closeHTML: null,
closeByEscape: true,
setEvent: 'click',
closeByDocument: true,
overlayClass: '',
minHeight: 80,
opacity: 65,
position: ['72px',],
overlayClose: true,
onOpen: OSX.open,
onClose:OSX.close
});
更新:添加了 HTML
<!-- modal content -->
<div id="osx-modal-content">
<div id="osx-modal-data">
<div id="simplemodal-container" class="simplemodal-container">
<div id="modal-placeholder" class="simplemodal-data" style="display: block;">
</div>
</div>
</div>
</div>