【发布时间】:2018-09-08 05:43:21
【问题描述】:
我有一个在悬停时隐藏/显示的 div。位置设置是绝对的,因此 div 的背景变得透明。如果位置设置为相对,则父 div 高度在悬停时会受到影响。
那么如何让背景遮挡,让内容不可见。
给出的样本:
$(document).ready(
function() {
$("#hover").hover(function() {
$("#message").toggle();
});
});
#message {
border: 1px solid;
padding: 10px;
box-shadow: 5px 10px #888888;
position:absolute;
display:none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="#"id="hover" >Click Here</a>
<div id="message">
<b>Hidden Content</b>
<br/>This is a very large content which overlaps the content at background.<br/><br/>So the content in background should not be seen.
</div>
<div>This is another text whose content should be hidden under the popup.</div><br/>
<div>One more text added whose content is visible even if the hidden content is visible.</div>
【问题讨论】:
-
您的代码不起作用。
-
@AamirKhan 修改了代码...现在我想将消息显示为弹出窗口。
-
@Quentin 提问被缩短。请解除保留
标签: html css angularjs twitter-bootstrap-3 popup