3
最近正在處理圖像地圖並嘗試在圖像地圖上進行懸停操作。自然我第一次嘗試.hover()
,但那不起作用,所以當我嘗試.mouseover()
工作。爲什麼.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()');
});
啊,好吧。這是有道理的呢。所以我將如何創建一個懸停事件?用於動態創建的元素 – Adjit 2014-11-06 17:08:28
我總是習慣這樣寫:。