Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.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 - Fatal编程技术网

Jquery 当鼠标悬停在链接之外时,基本工具提示将不显示动画

Jquery 当鼠标悬停在链接之外时,基本工具提示将不显示动画,jquery,Jquery,我的代码非常简单,我避免使用插件,如下所示: **CSS** .tooltip{ display:none; height:100px; width:100px; background-color:#000; } **HTML** <a href="#" class="testing"> link <div class="tooltip"> <!--information goes here --> </div> </a>

我的代码非常简单,我避免使用插件,如下所示:

**CSS**

.tooltip{
display:none;
height:100px;
width:100px;
background-color:#000;
}

**HTML**

<a href="#" class="testing">
link 
<div class="tooltip">
<!--information goes here -->
</div>
</a>


**JQUERY**
$('.testing').live('hover',function(){
$(this).children('.tooltip').fadeIn(300);},
function(){$(this).children('.tooltip').fadeOut(300);});
**CSS**
.工具提示{
显示:无;
高度:100px;
宽度:100px;
背景色:#000;
}
**HTML**
**JQUERY**
$('.testing').live('hover',function(){
$(this).children('.tooltip').fadeIn(300);},
函数(){$(this).children('.tooltip').fadeOut(300);});
问题是,当鼠标离开链接时,div“tooltip”不会消失,我的假设是因为我正在使用.live(),有人能帮我解决问题吗?

试试这个

$('.testing').live("mouseenter",function(){$(this).children('.tooltip').fadeIn(300);})
  .live("mouseleave", function() {
  $(this).children('.tooltip').fadeOut(300);
}); 

正在

上运行演示,正如您所知,我必须使用live()才能确认问题所在。live()似乎在为我工作!非常感谢你的帮助,没有这里的好人我不知道该怎么办。再次感谢@麦克比夫:这是一种互谅互让的关系。你给我们带来问题,我们给你解决方案,我们也能学到一些东西。:)