(jquery)将整个屏幕涂黑并突出显示页面的一部分? [英] (jquery) Blackout the entire screen and highlight a section of the page?

查看:159
本文介绍了(jquery)将整个屏幕涂黑并突出显示页面的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照下面的截图.我很确定有人以前做过这个! =)

As per screenshot below. I am pretty sure someone has done this before! =)

圈子是一个额外的奖励,如果对允许突出显示给定"div"的解决方案感到非常满意,那么

The circle is a bonus, would be very happy with a solution that allows highlighting of a given "div"

推荐答案

在此处查看以下示例→

不需要插件.只需很少的jQuery代码就可以实现这一点,在其上方的z-index处显示所选div的停电覆盖:

No need for a plugin. This can be accomplished with very little jQuery code, showing a blackout overlay with the selected div at a z-index above it:

$('.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类添加到要单击的任何孤立元素:

According to the following HTML & CSS... just add the expose class to any element you want isolated on click:

<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)将整个屏幕涂黑并突出显示页面的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆