Javascript jQuery fadein并在hover/mouseleave上淡出另一个div而不闪烁

Javascript jQuery fadein并在hover/mouseleave上淡出另一个div而不闪烁,javascript,jquery,fadein,fadeout,Javascript,Jquery,Fadein,Fadeout,我得到了这个HTML: <div class="cropit-image-preview-container" style="width: 300px; height: 200px; background: yellow; onmouseleave="hideedit()"> <div id="fotoedit" style="display: none;">edit</div> </div> 因此,fotoedit会出现在鼠标悬停在crop

我得到了这个HTML:

<div class="cropit-image-preview-container" style="width: 300px; height: 200px; background: yellow; onmouseleave="hideedit()">
  <div id="fotoedit" style="display: none;">edit</div>
</div>
因此,
fotoedit
会出现在鼠标悬停在
cropit image preview container
上,当您快速悬停并多次离开时,会在mouseleave上消失,而不会出现“闪烁”效果。它在firefox中工作得非常完美,但在chrome中却不行。正确的方法是什么?

试试下面的方法

我刚刚从Div中删除了onmouseleave,并正确地使用了jquery悬停事件。 在悬停事件中,第一个函数是mouseenter,第二个函数是mouseleave

就这样

$('.cropit图像预览容器')。悬停(函数(){
$('fotoedit').stop().fadeIn();
},函数(){
$(“#fotoedit”).stop().fadeOut();
});

编辑

你能发布JSFIDLE吗?它甚至不能与firefox一起工作jsfiddle@Matt123456是的,请:)
$('.cropit-image-preview-container').hover(function(){
    $('#fotoedit').stop().fadeIn();
});

function hideedit(){
    $("#fotoedit").stop().fadeOut();
}