Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如果鼠标进入徽标,请停止淡出_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 如果鼠标进入徽标,请停止淡出

Javascript 如果鼠标进入徽标,请停止淡出,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我有这把小提琴 现在,当鼠标离开时,它会消失。但当鼠标离开并再次进入徽标时,我想清除超时。但当我清除超时时,函数停止工作,因为启动时没有计时器。请帮帮我,谢谢 $('.logo').mouseenter(function(){ $('.bubble-container').fadeIn(); }); $('.logo').mouseleave(function(){ setTimeout(function() { $('.bubble-container')

我有这把小提琴

现在,当鼠标离开时,它会消失。但当鼠标离开并再次进入徽标时,我想清除超时。但当我清除超时时,函数停止工作,因为启动时没有计时器。请帮帮我,谢谢

$('.logo').mouseenter(function(){
    $('.bubble-container').fadeIn();
});

$('.logo').mouseleave(function(){
    setTimeout(function() {
         $('.bubble-container').fadeOut();
    },1000);
});
小提琴的工作:

小提琴的工作:


我很确定这会有用的。只需将超时放入一个全局变量,这样clearTimeout就可以访问它

var fadeOutTimeout;

$('.logo').mouseenter(function(){
    clearTimeout(fadeOutTimeout);
    $('.bubble-container').fadeIn();
});

$('.logo').mouseleave(function(){
    fadeOutTimeout = setTimeout(function() {
         $('.bubble-container').fadeOut();
   },1000);
});

我很确定这会有用的。只需将超时放入一个全局变量,这样clearTimeout就可以访问它

var fadeOutTimeout;

$('.logo').mouseenter(function(){
    clearTimeout(fadeOutTimeout);
    $('.bubble-container').fadeIn();
});

$('.logo').mouseleave(function(){
    fadeOutTimeout = setTimeout(function() {
         $('.bubble-container').fadeOut();
   },1000);
});

oic,你想阻止setTimeoutRhok偷了我的答案并拿到了支票lameoic,你想阻止setTimeoutRhok偷了我的答案并拿到了支票