我对悬停事件有一个奇怪的问题。当我将鼠标悬停在元素 (.helpImg) 上时,它将在悬停函数内运行我的代码的 4-6 次。我不确定如何调试它。有人有想法吗??非常感谢。
function test(){
console.log('testcall'); //this will only output 1 time
$('.helpImg').hover(function(){
         console.log('call'); //when hover the class, this will output multiple times (4~6 times randomly).          
         //the animation below will play multiple times too
          tooltip.css('display', 'block');
          tooltip.animate({ opacity: 0 }, 0);
          tooltip.animate({'opacity':'1','top':'-=10'},500);
        },function (){            
          $instance = $(this).css({'cursor': 'auto'});
          $('#tooltip-' + $instance.attr('id') ).hide(50);
          $(".js-tutorialTooltips").hide(50);
        })
}