如下面的屏幕截图所示。我很确定以前有人这样做过! =)
圆圈是一个额外的好处,如果有一个允许突出显示给定“div”的解决方案,我会非常高兴
最佳答案
See example of the following here →
无需插件。这可以通过很少的 jQuery 代码来完成,在其上方的 z 索引处显示所选 div 的黑色覆盖:
$('.expose').click(function(e){
$(this).css('z-index','99999');
$('#overlay').fadeIn(300);
});
$('#overlay').click(function(e){
$('#overlay').fadeOut(300, function(){
$('.expose').css('z-index','1');
});
});
根据以下 HTML 和 CSS...只需将 expose
类添加到您想要在单击时隔离的任何元素:
<div class="expose">Some content</div>
<textarea class="expose">Some content</textarea><br />
<input type="text" class="expose" value="Some content" /><br />
<div id="overlay"></div>
.expose {
position:relative;
}
#overlay {
background:rgba(0,0,0,0.3);
display:none;
width:100%; height:100%;
position:absolute; top:0; left:0; z-index:99998;
}
关于jquery - (jquery) 黑掉整个屏幕并突出显示页面的一部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5399442/