我想在 #original 悬停时显示 #hover,并带有淡入淡出。当用户停止将鼠标悬停在 #original 上时,#hover 应该淡出。
我正在使用这个代码。使用此功能,该元素会在悬停时显示,但在悬停结束时不会淡出。
$('#hover').hide();
$("#original").hover(function () {
$('#hover').fadeIn('');
});
任何帮助将不胜感激。谢谢,提前。
最佳答案
.hover
有两个回调。
语法
.hover( handlerIn(eventObject), handlerOut(eventObject) );
Description: Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
$("#original").hover(function () {
$('#hover').fadeIn();
},function () {
$('#hover').fadeOut();
});
Official Document
关于jquery - 悬停时显示元素并在悬停结束时隐藏回来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15583966/