gpt4 book ai didi

javascript - mouseenter 同时显示 :none is set

转载 作者:太空宇宙 更新时间:2023-11-04 16:11:06 24 4
gpt4 key购买 nike

我有一个在页面加载时隐藏的 div(使用 display: none;),我希望它在鼠标经过时淡入淡出。不幸的是,在设置 css 属性 display: none; 时,不会发送 mouseenter 事件。有解决方法吗?

div.overlay {
display: block;
visibility: hidden;
width: 860px;
height: 279px;

background-color: rgb(0,0,0);

position: absolute;
margin-top: -279px;

-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}

编辑:我正在谈论的页面在这里:http://alexzielenski.com/v2/当您将鼠标悬停在 slider 上时,我试图淡入 productDescription div

最佳答案

编辑:

<html>
<head>
<style>
html {
height: 100%;
width: 100%;
}
div.overlay {
visibility: hidden;
display: block;
width: 860px;
height: 279px;

background-color: rgb(0,0,0);

position: relative;
margin-top: -279px;

-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
</style>
</head>
<body>
<div onmouseenter="alert('now animate the div inside');">
<div class="overlay">
</div>
</div>
</body>
</html>

以下将不起作用,因为“visibility : hidden”或“display : none”都不会触发任何鼠标事件:

display: block; visibility: hidden

问题在于使用

display: none

不会将对象呈现给文档。

关于javascript - mouseenter 同时显示 :none is set,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8369421/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com