我有一些链接到hoverIntent事件的链接:
<div class="hovertrig">Hello</div>
<div class="hovertrig">Hello</div>
<div class="hovercard"></div>
将鼠标悬停在'hovertrig'上将相对于它定位'hovercard',但是当我将鼠标悬停在新位置'hovercard'div上时,它会淡出。我想阻止淡出,直到他们将鼠标指针移动到悬停卡/触发div之外一两秒钟。
我正在使用http://cherne.net/brian/resources/jquery.hoverIntent.html。这是jquery:
$(document).ready(function() {$('[data-shoptip]').hoverIntent(hoverOn, hoverOff);});
function hoverOn(t) {
$('.hovercard').show();
$('.hovercard').css('top', $(this).offset().top - 200).css('left', $(this).offset().left + 15);
console.log(this);
}
function hoverOff(t, event) {
$('.hovercard').fadeOut();
}