鼠标悬停时的谷歌地图 v3 标记信息窗口

发布于 2024-12-27 13:34:30 字数 463 浏览 1 评论 0原文

我已经在 stackoverflow 和其他论坛(包括 google 地图 v3 api 文档)中搜索了答案,但我找不到如何将触发标记信息窗口的事件从点击更改为鼠标悬停在我正在处理的文件中。

我正在使用谷歌库中的一个演示,其中包括融合表层。

您放大集群并查看位置的小红色圆圈标记。 您必须单击才能显示信息窗口。我希望翻转以显示信息窗口。

我的演示在这里: http://www.pretravelvideo.com/gmap2/

functions.js 文件完成了这里的大部分工作: http://www.pretravelvideo.com/gmap2/functions.js

I have scoured stackoverflow and other forums including the google maps v3 api docs for an answer but I cannot find how to change the event that fires the marker info window from click to mouseover in the files I am working with.

I am working with a demo from the google library that includes a fusion table layer.

You zoom into the clusters and see the small red circle markers for locations.
You have to click to reveal an info window. I wish to rollover to reveal the info window.

My demo is here:
http://www.pretravelvideo.com/gmap2/

The functions.js file does most of the work here:
http://www.pretravelvideo.com/gmap2/functions.js

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

等待圉鍢 2025-01-03 13:34:30

这是一个例子:
http://duncan99.wordpress.com/2011/10/08/google-maps -api-infowindows/

marker.addListener('mouseover', function() {
    infowindow.open(map, this);
});

// assuming you also want to hide the infowindow when user mouses-out
marker.addListener('mouseout', function() {
    infowindow.close();
});

Here's an example:
http://duncan99.wordpress.com/2011/10/08/google-maps-api-infowindows/

marker.addListener('mouseover', function() {
    infowindow.open(map, this);
});

// assuming you also want to hide the infowindow when user mouses-out
marker.addListener('mouseout', function() {
    infowindow.close();
});
酒绊 2025-01-03 13:34:30
var icon1 = "imageA.png";
var icon2 = "imageB.png";

var marker = new google.maps.Marker({
    position: myLatLng,
    map: map,
    icon: icon1,
    title: "some marker"
});

google.maps.event.addListener(marker, 'mouseover', function() {
    marker.setIcon(icon2);
});
google.maps.event.addListener(marker, 'mouseout', function() {
    marker.setIcon(icon1);
});
var icon1 = "imageA.png";
var icon2 = "imageB.png";

var marker = new google.maps.Marker({
    position: myLatLng,
    map: map,
    icon: icon1,
    title: "some marker"
});

google.maps.event.addListener(marker, 'mouseover', function() {
    marker.setIcon(icon2);
});
google.maps.event.addListener(marker, 'mouseout', function() {
    marker.setIcon(icon1);
});
最后的乘客 2025-01-03 13:34:30

感谢邓肯的回答,我最终得到了这个:

marker.addListener('mouseover', () => infoWindow.open(map, marker))
marker.addListener('mouseout', () => infoWindow.close())

Thanks to duncan answer, I end up with this:

marker.addListener('mouseover', () => infoWindow.open(map, marker))
marker.addListener('mouseout', () => infoWindow.close())
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文