我有需要在鼠标悬停和鼠标移出图标时淡入和淡出的用户菜单。我的问题是用户还应该能够将鼠标悬停在菜单上(或在这种情况下为 img),并且菜单不会淡出,以便他们可以单击其中的链接或图像。这是我的代码和一个jsfiddle。http://jsfiddle.net/anschwem/7mrM2/
<style>
div.notif
{
display:none;
position:absolute;
border:solid 1px black;
padding:8px;
background-color:white;
}
a.notif:hover + div.notif
{
display:block;
}
div.notif:hover
{
display:block;
}
</style>
<script type='text/javascript'>//NOT WORKING
$(window).load(function(){
$(document).ready(function()
{
$(".notif").hover(
function () {
$('.notif').fadeIn('slow');
},
function () {
$('.notif').fadeOut('slow');
}
);
});
});//]]>
</script>//NOT WORKING
</head>
<body>
<a class="notif" href="notifications.html" style="text-decoration:none;"><img src="images/bubble.png" style="position:relative; top:20px;"/></a>
<div class="notif" style="z-index:999999; ">
<a href="notifications.html"><img src="images/notif.png"/></a>
</body>