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

查看:18
本文介绍了(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天全站免登陆