Google Maps API v3:如何动态更改标记图标? [英] Google Maps API v3: How do I dynamically change the marker icon?

查看:90
本文介绍了Google Maps API v3:如何动态更改标记图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Google Maps API v3,如何以编程方式更改标记图标?我想要做的是,当某人悬停在某个链接上时地图上相应的标记图标会改变颜色来表示标记。



基本上,它与Roost的功能相同。



当您将鼠标悬停在左侧的房屋列表上时,右侧的相应标记将更改颜色。

调用 marker.setIcon('newImage.png') ...查看这里为文档。



您是否在问实际的方式?你可以创建每个 div ,并添加一个 mouseover mouseout 监听器会改变图标并返回标记。

Using Google Maps API v3, how do I programmatically change the marker icon?

What I would like to do is, when someone hovers over a link - to have the corresponding marker icon on the map change colors to denote the marker in question.

Essentially, the same function as what Roost does.

When you hover over a home listing on the left, the corresponding marker on the right changes color

解决方案

Call the marker.setIcon('newImage.png')... Look here for the docs.

Are you asking about the actual way to do it? You could just create each div, and a add a mouseover and mouseout listener that would change the icon and back for the markers.

这篇关于Google Maps API v3:如何动态更改标记图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆