[英]Display:none; not working in css
Hi I'm using this script below. 嗨,我在下面使用此脚本。
<script>
$(document).ready(function() {
$(".btn-slide").hover(function() {
$("#panel").slideDown(500);
});
$("#loginstuff").mouseleave(function() {
$("#panel").slideUp(500);
});
});
</script>
It creates a box when you hover over a link. 当您将鼠标悬停在链接上时,它将创建一个框。
Now the CSS is like this: 现在,CSS如下所示:
#panel {
display:none;
margin:80px 0 0 0;
width:180px;
background:#000;
border-radius:5px;
padding:7px;
color:#fff;
font-family:arial;
font-size:11px;
display:block;
word-spacing: 0px;
z-index:9999;
}
It's suppose to hide the panel div, and the script is suppose to show the div on hover. 假定隐藏面板div,脚本假定在悬停时显示div。
The only problem is that the div still displays on page load, can anyone help me with this problem. 唯一的问题是div仍在页面加载时显示,任何人都可以帮助我解决这个问题。
You have display: none
on the first line and then you have display: block
further down the block. 您有display: none
第一行没有display: block
,然后有display: block
在该块的下方继续display: block
。
Have you tried removing the second one? 您是否尝试删除第二个?
you are adding display:none;
您要添加display:none;
and then at bottom of css display:block;
然后在css底部display:block;
so its getting overridden, remove following line from your css for #panel: 因此,它会被覆盖,请从您的CSS中为#panel删除以下行:
display:block;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.