[英]Google Map V3 infowindows
I'm developing a website that incorporates a Google map v3 and I would like to know how to programmatically close the infowindows that can be opened when the user clicks on the icons that are loaded with the map. 我正在开发一个包含Google Map v3的网站,我想知道如何以编程方式关闭当用户单击随地图一起加载的图标时可以打开的信息窗口。 I don't mean the infowindows opened when the markers the site places on the map are clicked on. 我并不是说当单击站点在地图上放置的标记时打开的信息窗口。
Is this possible? 这可能吗?
Thanks in advance 提前致谢
var marker = new google.maps.Marker({
map: $scope.map,
icon: image
});
var infowindow = new google.maps.InfoWindow({
content: 'some text'
});
marker.addListener('mousedown', function() {
infowindow.open($scope.map, marker);
if (!marker.open) {
infowindow.open($scope.map, marker);
marker.open = true;
setTimeout(function() {
infowindow.close();
marker.open = false;
}, 2000);
} else {
infowindow.close();
marker.open = false;
}
});
In ur case u just have to replace marker with icon , icon or whatever must have a mousedown or click listener. 在这种情况下,您只需要用icon,icon或任何必须具有鼠标按下或单击侦听器的内容替换标记即可。
And marker.open & close is just a variable 而marker.open和close只是一个变量
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.