Javascript 如何使jquery在关闭鼠标悬停时停止运行操作?

Javascript 如何使jquery在关闭鼠标悬停时停止运行操作?,javascript,jquery,html,hover,imagemap,Javascript,Jquery,Html,Hover,Imagemap,我的jquery在imagemap的坐标悬停时运行我想要的操作,但当我在图像地图的坐标悬停时,该操作将保持不变。如果我将鼠标悬停在其他单词上,它仍然会显示第一次悬停时的动作。我希望能够将鼠标悬停在第一个坐标上,图像将返回其默认状态,然后如果我将鼠标悬停在另一个坐标上,它将运行该操作。当我将鼠标悬停在off位置时,它也将返回默认图像 这是我的密码:): $('#硬盘驱动器')。悬停(函数(){ $('#image').html(''); },函数(){ $('#image').html('');

我的jquery在imagemap的坐标悬停时运行我想要的操作,但当我在图像地图的坐标悬停时,该操作将保持不变。如果我将鼠标悬停在其他单词上,它仍然会显示第一次悬停时的动作。我希望能够将鼠标悬停在第一个坐标上,图像将返回其默认状态,然后如果我将鼠标悬停在另一个坐标上,它将运行该操作。当我将鼠标悬停在off位置时,它也将返回默认图像

这是我的密码:):


$('#硬盘驱动器')。悬停(函数(){
$('#image').html('');
},函数(){
$('#image').html('');
});
$('#cd')。悬停(函数(){
$('#image').html('');
},函数(){
$('#image').html('');
});
$('#fan')。悬停(函数(){
$('#image').html('');
},函数(){
$('#image').html('');
});
$('#powerblock')。悬停(函数(){
$('#image').html('');
},函数(){
$('#image').html('');
});
$('#graphicscard')。悬停(函数(){
$('#image').html('');
},函数(){
$('#image').html('');
});
$('#散热器')。悬停(函数(){
$('#image').html('');
},函数(){
$('#image').html('');
});
$('#主板')。悬停(函数(){
$('#image').html('');
},函数(){
$('#image').html('');
});
我的默认图像是computer.jpg


希望您能提供帮助:)

如何使用onmouseover和onmouseout?

谢谢,那会很有帮助的!:)<代码>$。hover与onnouseover/onmouseout(某种程度上)有着相同的功能,不是吗?@JuanMendes这是我的想法,但我无法通过hover获得“onmouseout”操作。你可以使用纯javascript,如果需要更多帮助,请询问我。查看我的示例<代码>函数holaa(){document.getElementById('mensaje').innerHTML=“holaa”}函数chauu(){document.getElementById('mensaje').innerHTML=“chauu”}重置:`function resetMensaje(){`
<div id="image">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<img src="computer.jpg" usemap="#parts">
<map name="parts">
<area shape="poly" coords="1,131,102,80,124,108,108,143,-1,198,2,132" id="harddrive" href="#">
<area shape="poly" coords="0,199,106,144,117,128,101,171,1,220,1,200" id="cd" href="#">
<area shape="poly" coords="167,136,244,95,263,102,298,162,211,205,166,136" id="fan" href="#">
<area shape="poly" coords="110,63,192,19,197,1,225,2,260,62,241,93,157,139" id="powerblock"   href="#">
<area shape="poly" coords="132,287,240,238,263,273,155,319,131,286" id="graphicscard" href="#">
<area shape="poly" coords="160,318,219,294,213,319,229,334,217,369,170,388,147,367,159,318"       id="heatsink" href="#">
<area shape="poly" coords="172,389,259,353,273,384,207,413,192,413" id="motherboard" href="#">
</map>

<script type="text/javascript">

$('#harddrive').hover(function() {
$('#image').html('<img src="computer-harddrive.jpg">');
}, function() {
$('#image').html('');
});

$('#cd').hover(function() {
$('#image').html('<img src="computer-cd.jpg">');
}, function() {
$('#image').html('');
});

$('#fan').hover(function() {
$('#image').html('<img src="computer-fan.jpg">');
}, function() {
$('#image').html('');
});

$('#powerblock').hover(function() {
$('#image').html('<img src="computer-power.jpg">');
}, function() {
$('#image').html('');
});

$('#graphicscard').hover(function() {
$('#image').html('<img src="computer-graphicscard.jpg">');
}, function() {
$('#image').html('');
});

$('#heatsink').hover(function() {
$('#image').html('<img src="computer-heatsink.jpg">');
}, function() {
$('#image').html('');
});

$('#motherboard').hover(function() {
$('#image').html('<img src="computer-motherboard.jpg">');
}, function() {
$('#image').html('');
});

</script>