Jquery 为什么.hover()不适用于映射图像,而.mouseover()适用于映射图像?

Jquery 为什么.hover()不适用于映射图像,而.mouseover()适用于映射图像?,jquery,html,image,imagemap,Jquery,Html,Image,Imagemap,最近正在处理图像地图,并试图在图像地图的悬停处做一些事情。当然,我首先尝试了.hover(),但没有成功,所以当我尝试.mouseover()时,成功了 我的问题是,为什么一个有效而另一个无效 /*This function works*/ $(document).on('mouseover', '#some-map', function(){ console.log('I am hovering with mouseover()'); }).on('mouseout', functio

最近正在处理图像地图,并试图在图像地图的悬停处做一些事情。当然,我首先尝试了
.hover()
,但没有成功,所以当我尝试
.mouseover()
时,成功了

我的问题是,为什么一个有效而另一个无效

/*This function works*/
$(document).on('mouseover', '#some-map', function(){
    console.log('I am hovering with mouseover()');
}).on('mouseout', function(){
    console.log('I am no longer hovering with mouseover()');
});

/*This function does not work*/
$(document).on('hover', '#some-map', function(){
    console.log('This is from hover()');
}, function(){
    consoel.log('Out from hover()');
});
jquery中没有('hover'…方法,您可以这样编写它

$('#some-map').hover(function(){
   alert('This is from hover()');
}, function(){
   alert('Out from hover()');
});

啊,好吧。那就有道理了。那么我如何为动态创建的元素创建悬停事件呢?我总是这样写:单击$('button')。在('Click',function(){$('body')。追加('hello world');$('some map')。悬停(function(){alert('s from hover()');},function(){alert('Out from hover()');})