google map api v3的infowindow上是否有任何鼠标事件。喜欢closeclick事件。 实际上我在3秒后关闭了信息窗口。但我想要,如果鼠标指针超过infowindow然后它不应该是关闭plesae给我的例子来做它.. 非常感谢你。
我的代码编写如下---
function generateMarkers(locations, is_paid)
{ var marker; for (var i = 0; i < locations.length; i++)
{
var marker;
for (var i = 0; i < locations.length; i++) {
createMarker(new google.maps.LatLng(locations[i][0], locations[i][1]), locations[i][2], locations[i][3], locations[i][4], is_paid);
}
}
function createMarker(pos, name, town, image, is_paid) {
var infowindow;
var marker = new google.maps.Marker({
position: pos,
map: map, // google.maps.Map
title: name,
icon: "images/red.png"
});
infowindow = new google.maps.InfoWindow
({
content: '<div id="dvContent" onmouseover="clearTime()" onmouseout="clearwindow()"><div style="color:black;float:left"><img src="' + image + '" width="50px" height="50px"/></div><div style="color:black;margin-left:60px">' + name + '<br>Address:' + town + '<br><a href="#" target="_blank" style="color:blue">www.somethingcupid.com</a></div></div>'
});
google.maps.event.addListener(marker, 'mouseover', function () {
if (is_paid != "True") {
document.getElementById("divPopup").style.display = "block";
}
else {
infowindow.open(map, marker);
}
});
google.maps.event.addListener(marker, 'mouseout', function () {
if (is_paid != "True") {
document.getElementById("divPopup").style.display = "block";
}
else {
t = setTimeout(function () { infowindow.close() }, 3000);
}
});
}
function clearTime() {
clearTimeout(t);
}enter code here
function clearwindow() {
setTimeout(function () { infowindow.close() }, 3000);
}
答案 0 :(得分:0)
与鼠标活动相关的唯一InfoWindow event为closeclick
。
您可以在InfoWindow内容中使用<div>
并使用其鼠标事件。 (活动区域周围将存在非活动边框。)