【发布时间】:2016-03-09 16:41:52
【问题描述】:
我是 html/css/jquery 语言的新手,所以如果我的问题看起来太明显,请原谅我。
我的目标是在单击 div 时显示全屏覆盖 div(此步骤实际上与切换功能一起使用),然后通过单击它使相同的 div 消失。
我浏览了许多相关主题,但似乎找不到解决问题的方法。如何通过单击其上的任意位置使全屏 div 消失(单击第一个 div 不是一个选项,因为它是故意隐藏的)?
到目前为止,这是我的代码:
JavaScript (jQuery):
$(function() {
$("#bandeau").click(function() {
$("#full_screen").toggle();
});
});
HTML:
<div id="bandeau">content</div>
<div id="full_screen">
<div class="info_visible" id="about">content</div>
</div>
CSS:
#bandeau {
background-color: black;
overflow: hidden;
cursor: crosshair;
width: 100%;
height: 57px;
z-index: 1000;
position: fixed;
}
#full_screen {
background-color: black;
overflow: hidden;
cursor: crosshair;
width: 100%;
height: 100%;
z-index: 1000;
position: fixed;
display: none;
margin: 0px;
padding: 0px;
}
.info_visible {
width: 100%;
height: auto;
color: white;
padding-top: 10px;
padding-bottom: 20px;
padding-left: 30px;
position: fixed;
}
【问题讨论】:
标签: javascript jquery html css