【发布时间】:2015-03-18 06:12:43
【问题描述】:
当鼠标悬停/鼠标移出折线路径时,我想显示和隐藏工具提示,问题是我的折线路径只有 2 的笔划宽度,所以不容易打到鼠标悬停事件中的区域,这绝对不方便用户体验。
我想知道是否有一种方法可以使用任意宽度使该命中区域变宽,但对用户不可见?
下面我的代码的sn-p
path = new google.maps.Polyline(plotOptions);
path.setMap(that.map);
this.polyPathArray.push(path);
google.maps.event.addListener(path, 'mouseover', (function(index) {
return function(polyMouseevent) {
$(".table>tbody>tr>td").removeClass('highlight');
$(".table>tbody>tr").eq(index).find("td").addClass('highlight');
var latlngVal = '';
if(polyMouseevent) {
latlngVal = polyMouseevent.latLng;
} else {
//calculate a random position on a polyline
}
that.infowindows[index].setPosition(latlngVal);
that.infowindows[index].open(that.map);
};
})(i));
任何帮助将不胜感激:)
【问题讨论】:
-
我在类似问题上也需要帮助。链接:jsfiddle.net/9bg6x/125。当您在折线路径上移动时,我的工具提示会一直闪烁。请帮忙.. :(
标签: javascript geocode google-polyline geomap