这个解释起来有点困惑。在我的页面上http://newmedia.leeds.ac.uk/ug10/cs10mm/abduction.html 我有一个显示“更多”和“更少”的选项。单击时,会出现一个带有文本和背景图像的下拉列表。然而,下拉 div 的背景图像的一小部分(顶部)不会隐藏。有谁知道这是为什么?
下面是 html,然后是 css:
<div id="MORE">
<button id="more">More</button>
<button id="less">Less</button>
<div id="instructions">
<p style="display: none"> The Mayor of Scaredy Cat Town has been abducted. Lawlessness has broken out across London and the city needs your help to find him. Follow the links on this site to scour the city in search of The Mayor. A reward, courtesy of The Mayor and his staff, is available for anyone able to find him. <br /> The Reward... <br /> An exclusive night of entertainment at the Mayors up-market bar, hosted by his head waiter,Henri. </p>
</div>
<script>
$("button#more").click(function () {
$("p").show("slow");
});
$("button#less").click(function () {
$("p").hide("slow");
});
</script>
</div>
CSS...
#MORE {
position:relative;
z-index:100;
}
#more, #less {
background:none;
border:none;
color:#FFF;
font-family:Verdana, Geneva, sans-serif;
cursor: pointer;
最佳答案
发生这种情况是因为您隐藏了 p
标签并且背景位于其容器 instructions 上。
而是隐藏它。
$("#instructions").show("slow");
关于jquery - 如何隐藏已经被jquery隐藏的div的背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8763176/