Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.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
jQuery悬停元素淡出/淡出子元素,无循环_Jquery_Fadein_Fadeout - Fatal编程技术网

jQuery悬停元素淡出/淡出子元素,无循环

jQuery悬停元素淡出/淡出子元素,无循环,jquery,fadein,fadeout,Jquery,Fadein,Fadeout,我一直在尝试许多没有解决方案的路线:我尝试在一个元素上悬停,淡出一个子元素,暂停一段时间,然后再次淡出同一个子元素。我在努力。排队,然后。在这里停下来,甚至一起不工作。也尝试了很多不同的方法 $('.project').mouseover(function(){ $('.skill h2', this).fadeOut(500).queue(function(){ $(this).stop(true,true).fadeIn(400); }); }); 尝试使用

我一直在尝试许多没有解决方案的路线:我尝试在一个元素上悬停,淡出一个子元素,暂停一段时间,然后再次淡出同一个子元素。我在努力。排队,然后。在这里停下来,甚至一起不工作。也尝试了很多不同的方法

$('.project').mouseover(function(){
    $('.skill h2', this).fadeOut(500).queue(function(){
        $(this).stop(true,true).fadeIn(400);
    });
});
尝试使用

设置计时器以延迟队列中后续项目的执行


我猜您要做的是保持父元素的原样。 淡出将导致div显示:无,因此父元素将塌陷,除非您为其指定固定的高度和宽度

您还在jquery调用中添加了“this”,这也将导致父元素或调用元素淡出

将此添加到css中

.project{
    height:80px;
    width:367px;
}  
或任何维度

将jquery设置为这样

 $('.project').mouseenter(function(){
    $('.skill h2').fadeOut(500,function(){
       setTimeout(function(){
         $('.skill h2').fadeIn(400);console.log('here');
        },1000);
    });
  });

看看这把小提琴

尝试使用delay()。用于延迟队列中的动画,还可以添加一个JSFIDLE plz。fadeOut和fadeIn还有一个回调函数。不要排队,而是使用回调。尝试了多种延迟方式,请参阅fiddle:我想这是可行的
 $('.project').mouseenter(function(){
    $('.skill h2').fadeOut(500,function(){
       setTimeout(function(){
         $('.skill h2').fadeIn(400);console.log('here');
        },1000);
    });
  });