jquery与谷歌地图gmarker
假设我有一个Google maps v2 GMarker,如下所示:jquery与谷歌地图gmarker,jquery,google-maps,hoverintent,Jquery,Google Maps,Hoverintent,假设我有一个Google maps v2 GMarker,如下所示: var marker = new GMarker(point, { icon :myicon, title :'whatever' }); GEvent.addListener(marker, "mouseover", function() { myover(pointid); }); GEvent.addListener(marker, "mouseout", function() { myout(point
var marker = new GMarker(point, {
icon :myicon,
title :'whatever'
});
GEvent.addListener(marker, "mouseover", function() {
myover(pointid);
});
GEvent.addListener(marker, "mouseout", function() {
myout(pointid);
});
我想要类似jquery-hoverintent的行为,而不是正常的mouseover和mouseout事件,以避免在屏幕上移动鼠标和意外触摸GMarker时出现过度活动。我希望我的功能只在鼠标减速或停在标记处时触发。对于正常的dom元素,如表行(tr),可以使用hoverintent解决这个问题
我的问题是,我不知道如何使用jQuery选择GMarker。
如果做不到,我该如何用其他方式将我的Gmarker与hoverintent挂钩
谢谢,我根据这个答案滚动自己的答案,解决了这个问题: 这只会在没有缓慢移动鼠标光标的情况下提供延迟,但现在已经足够了 结果是:
GEvent.addListener(marker, "mouseover", function() {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
this.timer = setTimeout(function() {
myover(pointid);
}, 100);
});
GEvent.addListener(marker, "mouseout", function() {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
myout(pointid);
});