1
谷歌地图api v3的infowindow上是否有任何鼠标事件?像closeclick事件一样。 其实我3秒后关闭信息窗口。但我希望如果鼠标指针结束infowindow那么它不应该接近plesae给我例如做它.. 非常感谢。谷歌地图api中的infowindow鼠标事件
我的代码编写如下---
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);
}
这是我的信息窗口的内容: 内容:“
Address:' + town + '
乔利好。为div'dvContent'添加一个'mouseover'事件,它运行一个关闭其他InfoWindows的函数。 – 2012-07-20 08:45:30
其实我3秒后关闭信息窗口。但我希望,如果鼠标指针结束infowindow然后它不应该是接近plesae给我的例子做到这一点.. – Pushpendra 2012-07-20 11:53:26