您无法真正创建“无法关闭”的弹出窗口。但是,您可以用灯箱覆盖整个页面。作为概念证明,我在 jQuery 的帮助下将其结合在一起。这是非常基本的,需要相当多的命名空间/清理/等。http://jsfiddle.net/CJCQQ/
CSS:
#page-cover {
background-color: #888;
display: none;
position: absolute;
width: 100%;
height: 100%
}
#uncloseable-lightbox {
background-color: #000;
height: 200px;
position: absolute;
left: 10px;
top: 10px;
width: 500px;
}
#uncloseable-lightbox button { position: absolute }
#uncloseable-lightbox #close-button { top: 10px; right: 10px;}
#uncloseable-lightbox #click-first-button { bottom: 10px; left: 10px;}
HTML:
<div id="page-cover">
<div id="uncloseable-lightbox">
<button id="close-button">close</button>
<button id="click-first-button">Click Me First</button>
</div>
</div>
<button id="open-button">Open</button>
JS:
$(document).ready(function () {
var outerThis = this, canClose = false;
$('#open-button').on('click', function (e) {
e.preventDefault();
$('#page-cover').show();
});
$('#close-button').on('click', function (e) {
e.preventDefault();
if(outerThis.canClose) {
$('#page-cover').hide();
outerThis.canClose = false;
}
});
$('#click-first-button').on('click', function (e) {
outerThis.canClose = true;
});
});