gpt4 book ai didi

当鼠标悬停在多个链接上时,jquery 鼠标悬停会使 DIV 变得疯狂

转载 作者:行者123 更新时间:2023-12-01 07:12:13 25 4
gpt4 key购买 nike

早上好

看我的js http://jsfiddle.net/LEyFW/

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {

$(".mark").bind("mouseover", function () {
var DivId = $(this).attr("href");
$('.icontent').hide();
$(DivId).fadeIn(300);
});
$(".mark").bind("mouseout", function () {
$('.icontent').hide();
$("#defaultdiv").fadeIn(300);
});
});

</script>


<style>


ul {



padding:0px 0px 0px 30px;

}

ul > li {

color: #dc3fb0;

}

ul > li > span {

color: #58595b;

}

.title {

font-family:Verdana, Geneva, sans-serif;

font-size: 18px;

color: #58595b;

border-bottom: solid 2px #666666;

padding-left: 15px;

padding-top:5px;

}

#Contenair {

border: solid 2px #666666;

height:246px;

width:500px;

}

icontent {
width: 454px;
height: 246px;


}

a {
text-decoration: none;
}


</style>


</head>

<body bgcolor="#e3e3e3">
<div style="height:490px; width:454px;">
<table style="background-color: #FFF;" width="454" height="460" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="background-image:url(public-finance-bg.jpg); background-repeat: no-repeat; background-position-x: 4px;
background-position-y: 20px; font-family:Verdana, Geneva, sans-serif; font-size: 17px; color: #58595b; height: 300px;">
<div class="icontent" id="defaultdiv">
<div style="padding-top: 10px;
height: 70px; padding-left: 9px;">Network Rail ordered to pay back
£53m over late trains</div>
<img src="train.jpg" width="454" height="246" />
</div>
<div class="icontent" style="display: none" id="cont1">
<div style="padding-top: 10px;
height: 70px; padding-left: 9px;">Public Finance random news</div>
<img src="plane.jpg" width="454" height="246" />
</div>
<div class="icontent" style="display: none" id="cont2">
<div style="padding-top: 10px;
height: 70px; padding-left: 9px;">Better Care Fund cash 'could finance hospitals</div>
<img src="bus.jpg" width="454" height="246" />
</div>

<div class="icontent" style="display: none" id="cont3">
<div style="padding-top: 10px;
height: 70px; padding-left: 9px;">Ministers sign 'single pot' growth deals</div>
<img src="car.jpg" width="454" height="246" />
</div>

</td>
</tr>
<tr style="height: 27px;">
<td style="font-family:Verdana, Geneva, sans-serif; font-size: 18px; color: #58595b; border-bottom: solid 2px #666666; padding-left: 15px; padding-top: 12px;">Latest News</td>
</tr>


<tr style="height: 35px;">
<td height="22" valign="top" style="font-family:Verdana, Geneva, sans-serif; font-size: 11px; color: #58595b;">
<ul>
<li><a href="#cont1" class="mark" id="mark1"><span style="color: #666;">Better Care Fund cash could finance hospitals</span></a>
</li>
</ul>
</td>
</tr>
<tr style="height: 35px;">
<td height="22" valign="top" style="font-family:Verdana, Geneva, sans-serif; font-size: 11px; color: #58595b;">
<ul>
<li><a href="#cont2" class="mark" id="mark2"><span style="color: #666;">Better Care Fund cash could finance hospitals</span></a>
</li>
</ul>
</td>
</tr>

<tr style="height: 35px;">
<td valign="top" style="font-family:Verdana, Geneva, sans-serif; font-size: 11px; color: #58595b;">
<ul>
<li> <a href="#cont3" class="mark" id="mark3"><span style="color: #666;">Better Care Fund cash could finance hospitals</span></a>
</li>
</ul>
</td>
</tr>

</table>


</div>

</body>
</html>

我有一个鼠标悬停用于在同一个框中显示不同的 div 内容。

有效,但是 - 尝试快速将鼠标悬停在所有链接上,您就会看到会发生什么。多个 div 开始出现并且卡住了。

有什么办法可以平静下来吗?

最佳答案

Demo

stop(true)

试试这个。它不会导致子句多个动画。

关于当鼠标悬停在多个链接上时,jquery 鼠标悬停会使 DIV 变得疯狂,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25056050/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com