English 中文(简体)
谷歌地图
原标题:Google Maps Marker Icon Auto Changing

页: 1 依据自动更新多功能元件的内装内容。

I ve looked at the documentation for addListener and addDomListener, but it s all mouseovers and clicks and stuff. I need it to detect a change in the pure HTML content of the element in question, and if that value meets certain conditions, change the marker s icon based on it.

这里我使用的是:

infowindow=new google.maps.InfoWindow();
for (i=0;i<buildings.length;i++){
    marker=new google.maps.Marker({
        position:new google.maps.LatLng(buildings[i][4],buildings[i][5]),
        map:map,
        shadow:shadow,
        icon:greenIcon,
        title:buildings[i][0]+" 
"+buildings[i][1],
        zIndex:buildings[i][6]
    });
}

我想加上一个<代码>Interval,与j Query一道,将buildings[i][7]的阵容价值(不含上述内容)与所涉批次内容相等,然后作一些有条件的声明,以确定其是否符合更改标识的icon的适当标准。

但此后,我失去了如何根据动态更新的价值使标记真正改变。

最佳回答

订立与<代码> Marker有关的单项内容,请登录<代码>。 Marker.setIcon function. 它接受一个参数,即:

  1. A string that contains the relative location of the icon image file (as in your code), OR -
  2. A MarkerImage, which gives you more control (anchor, origin, size, etc.) over how the icon image is displayed
问题回答

缩略语

  var beachMarker = new google.maps.Marker({
      position: myLatLng,
      map: map,
      icon: image
  });
  map.addOverlay (beachMarker );




相关问题
How to decide the current point reach on google map?

How to decide the current point reach on google map? I have a list of points (pickup points) of a route that I want to show in my google map with polyline. Now i have to get the current location of ...

Topographical or relief data in Map APIs

I was wondering if anyone knew of any map APIs that offer topographical or relief data? I ve had a quick look at Google and Bing APIs, but could find nothing there. Google allow you to view a map as ...

Using maps on Windows Mobile

I m experimenting with maps on different mobile platforms. Getting Google Maps to work on Android was easy, following this tutorial. Getting the same to work on Windows Mobile is a different matter. ...

Adding a custom icon to a google map

I need a hand adding a custom icon to some Google Maps javascript. Code below for your reference: function populateMap() { var map = new GMap2(document.getElementById("map")); map.setCenter(new ...

RSS to KML Overlay

I m want to display my blog as a Google Map overlay (each post contains geotags). How can I dynamically create a KML overlay from an RSS? Or better, how can I create a loop (PHP) that would display ...

开放街道地图管理员

我需要开放Street的标记管理员。 地图,如山角地图。

热门标签